Creating User adding logon rights

Author Message
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)
0
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)  
 
#1
    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)
    0
    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.
     
    #2
      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)
      0
      My Favourite Season
      If you were a teardrop;In my eye, Edmonton Escort For fear of losing you,I would never cry  ,Edmonton EscortsAnd if the golden sun,Should cease to shine its light, Edmonton Asian EscortJust one smile from you,Would make my whole world bright Edmonton Asian Escorts
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9