NetRock
-
Total Posts
:
2
- Scores: 0
-
Reward points
:
0
- Joined: 9/30/2011
-
Status: offline
|
Creating User adding logon rights
Friday, September 30, 2011 11:11 AM
( permalink)
Hi, I am trying to create Vbscript to create user and read the administrator's name (for different languages) from a file "sFile" (has only one word) and using ntrights (found in resources Kit) add logon rights but getting errors. I was wondering if someone can help out. I already have a working batch file to do this but msgbox is not that attractive in batch file, that's why, i need to do it in VBScript. Thanks. Dim oFSO, sFile, oFile, sText, sadmingroupname strVBFile=Nameadmin.vbs sFile = "c:\Nameadmin.txt" Set oWSHShell = CreateObject("WScript.Shell") oWSHShell.CurrentDirectory = "C:\Program Files\Speed" Return = oWSHShell.Run("net user BMW /delete", 1, True) Return = oWSHShell.Run("net user -user BMW Speed2000@1", 1, True) If return <> 0 Then MsgBox "Creation of BMW user has failed. Please, check log file, vbOkonly, "Information" End If WSHShell.Run "wscript " & strVBFile, , True Set oFSO = CreateObject("Scripting.FileSystemObject") If oFSO.FileExists(sFile) Then Set oFile = oFSO.OpenTextFile(sFile, 1) Do While Not oFile.AtEndOfStream sText = oFile.ReadLine If Trim(sText) <> "" Then sadmingroupname=sText End If Loop oFile.Close Else WScript.Echo "The sFile was not there." End If Return = oWSHShell.Run("net user BMW Speed2000@1 /ADD", 1, True) Return = oWSHShell.Run(cusrmgr -u BMW -alg sadmingroupname -c "BMW" -f "BMW" -S MustChangePassword +S CanNotChangePassword +s PasswordNeverExpires -s AccountDisabled -s AccountLockout -s RASUser -P Speed2000@1) Return = oWSHShell.Run(ntrights -u BMW +r SeServiceLogonRight) Return = oWSHShell.Run(ntrights" -u BMW +r SeBatchLogonRight)
|
|
|
|
59cobalt
-
Total Posts
:
969
- Scores: 91
-
Reward points
:
0
- Joined: 7/17/2011
-
Status: offline
|
Re:Creating User adding logon rights
Friday, September 30, 2011 10:47 PM
( permalink)
Wrong forum. That said, Run() expects a string as its first argument. A string literal starts with double quote character and ends with a double quote character. Any double quote characters in between must be escaped.
|
|
|
|
wenbibi
-
Total Posts
:
11
- Scores: 0
-
Reward points
:
0
- Joined: 12/18/2011
-
Status: offline
|
Re:Creating User adding logon rights
Sunday, December 18, 2011 4:31 PM
( permalink)
|
|
|
|