Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing the 'Local Security Setting' using VBScript? 1

Status
Not open for further replies.

KasperK

IS-IT--Management
Nov 27, 2002
5
0
0
DK
Hello All

I'm trying to change members with the 'Log on locally' rights in the Local security policy on a number of servers. Both NT4 and W2K servers, I am trying to do this via a script, as our AD is not yet in place. If so, I could simple use a GPO to handle this issue.

My problem is to find the reference to this setting, anyone having a syntax proposal for me?

I was not successfull at the Technet scriptcenter if anybody have a good
URL?

Any comments will be truly appreciated.

Best regards

Kasper
 
Hello,
we an exe called ntrights.exe, command line tool, with following

rem *** Remove local logon for all Users, only local admins are allowed
rem *** this step is taken due to security problems on the D: drive (decission during project meeting)
%SystemRoot%\CmdFSC\ntrights.exe -u Users -r SeInteractiveLogonRight

i can email you the exe if you like. I have never seen/read details of using vbscript directly.

i think MS advice to create a security template with poledit and then apply that, but...

regards,
Richard
 
Thanks

I had the reskit installed and I should have had a look there in the first place :)

Very helpful

Best regards
 
hello,

I too am trying to change this security setting on a number of W2K servers. Could you tell me exactly what you used in order to do this.

I have been trying to script it - but no luck as yet.

Jim
 
Hello Jim

Please ignore Danish comments in the script :)

Note that the variable 'Users' take the name of the user you wish to remove the right from. I've a problem using usernames with spaces, I have not had the time to fix that. Pls develope on this and return if you're successfull

good luck
Kasper

Here is the script:



Dim objFSO, objWSH, objArgs, Valg, Server, Drev, Dato, Quota, CurrentDir, LogFileLoc, UsrInit, usrInitNr, UsrInitListe, NoMailFile
Dim FileOutName, Filliste, objFilListe, objFileOut, InPutLogFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWSH = CreateObject("WScript.Shell")
Set objArgs = WScript.Arguments
'CurrentDir = objWSH.CurrentDirectory 'Current Directory
LogFileLoc = CurrentDir 'Logfilen gemmes her
Dato = date 'Dato
Users = "Guest"


OutPutFile = "Results_" & Dato & ".txt"
Set objFileOut = objFSO.OpenTextFile(OutPutFile,2, true)

ServerListe = "ServerList.txt" 'List of servers to be processed
Set objFileSrvList = objFSO.OpenTextFile(ServerListe,1)

Do

strComputer=objFileSrvList.ReadLine
Set objCmd = objWSH.Exec("ntrights -m \\" & strComputer & " -u users -r SeInteractiveLogonRight")
strPResult = objCmd.StdOut.Readall()
objFileOut.write strPResult

Loop Until objFileSrvList.AtEndOfStream
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top