Results 1 to 4 of 4

Thread: New User Creation

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    262

    New User Creation

    Hello everyone, I know this isn't the correct forum to post in, but no one is active in the vbscript forum. Hoping someone here can take a quick look at let me know what I am doing wrong, this is the last piece that is hanging me up.

    I just started a new job where we frequently need to create new FTP accounts. The accounts are stored locally on a server running Windows Server 2003

    Current I just go in and do a "NET USER xxxx xxxx ..." but now I want to create a script to fill in the xxxx stuff and it will create all my folders as well

    I have the script creating the folders and creating the account, but I cannot modify certain parts of the account. For example, I need to set a comment on the account but if the comment is more than one word, it errors out. here is the code that I have right now

    VB Code:
    1. Dim sTopDirectory, sUserAccounts, sServerName, sUserPassword, sFirstName, sLastName
    2.  
    3. Set oArgs = Wscript.Arguments
    4. sTopDirectory = oArgs(0)
    5. sUserAccounts = oArgs(1)
    6. sServerName = oArgs(2)
    7. sUserPassword = oArgs(3)
    8. sFirstName = oArgs(4)
    9. sLastName = oArgs(5)
    10.  
    11. If oArgs.Count <> 6 Then
    12.     Wscript.Echo "Syntax:  folder.vbs TopDirectory UserAccounts ServerName Password FirstName LastName"
    13.     Wscript.Echo " "
    14.     Wscript.Echo " "
    15.     Wscript.Quit 1
    16. End If
    17.  
    18. Set WshShell = WScript.CreateObject("Wscript.Shell")
    19. Return = WshShell.run("cmd /c NET USER "& sTopDirectory &" "& sUserPassword &" /ADD",0,true)
    20. Wscript.Echo Return
    21. Return = WshShell.run("cmd /c NET USER "& sTopDirectory &" /COMMENT:"user of d$\(in/out)" ",0,true)
    22. Wscript.Echo Return

    The error happens at the following bold section:

    Return = WshShell.run("cmd /c NET USER "& sTopDirectory &" /COMMENT:"user of d$\(in/out)" ",0,true)

    The error says that it expects a ")"

    Please let me know what to do!!

  2. #2
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: New User Creation

    VB Code:
    1. Return = WshShell.run("cmd /c NET USER "& sTopDirectory &" /COMMENT:"user of d$\(in/out)" ",0,true)

    try this:
    VB Code:
    1. Return = WshShell.run("cmd /c NET USER " & sTopDirectory & " /COMMENT: user of d$\(in/out)",0,true)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    262

    Re: New User Creation

    When I do that, the account is created but the comment is not filled in.

  4. #4
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: New User Creation

    try this:

    VB Code:
    1. Return = WshShell.run("cmd /c NET USER " & sTopDirectory & " /COMMENT: " & "user of d$\(in/out)",0,true)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width