Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript batch script
I want to write two scripts, they can be vbs or ms-dos commands.
 
First is setting a user permission for a folder (the equivalent to: right click on a folder, properties, security, edit, add, NT AUTHORITY\NETWORK SERVICE).
 
Second is to set a permision to run as a service, the equivalent click click is: Control Panel / Administrative Tools / Local Security Policy; left side: Local Policies / User Rights Assignment; right side: Log on as a service -> add Network Service as a user that has rights.
 
Would somebody help me to do that please?
Posted 12-Dec-11 5:32am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can write such scripts using the utility CACLS.EXE, here is the help on it: http://ss64.com/nt/cacls.html[^].
 
Alternatively, run
CACLS > cacls.help.txt
to obtain the text file with the options of the utility currently available in your system.
 
Needless to say, the account on which your batch script is executed should have enough permission to modify the permissions in questions. You can check this in UI using the properties dialog of the file system object you are interested in.
 
—SA
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

thanks for answer!
 
the commands I used are:
folder permission:
CACLS path_of_folder /E /T /C /G "userName":F
log on as a service permission:
ntrights -u "userName" +r SeServiceLogonRight
 
Here you can find ntrights description
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 544
2 Maciej Los 325
3 DamithSL 223
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,712
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 13 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100