Computing.Net > Forums > Programming > Creating a user account

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Creating a user account

Reply to Message Icon

Name: MCowan
Date: September 15, 2008 at 05:41:35 Pacific
OS: xp/Vista
CPU/Ram: n/a
Product: n/a
Comment:

I am attempting to create a pre-defined user account with a password set by the user. I keep getting the following error:

Line: 22
Char: 39
Error: Expected 'Loop"
Code: 800A03FB

Here is my code:

' ------ SCRIPT CONFIGURATION ------
strUserName1 = "remote-emar"
strFullName1 = "Remote eMAR"
strDescr1 = "Remote Support Account"
strGroup = "Administrators"
strComputer = CreateObject("WScript.Network").ComputerName
title = "User Account Creation"
' ------ END CONFIGURATION ---------
do
strPassword1 = InputBox("Enter remote-emar account password. *case sensitive*", title)

set objSystem = GetObject("WinNT://" & strComputer)
set objUser = objSystem.Create("user", strUserName1)
objUser.FullName = strFullName1
objUser.Description = strDescr1
objUser.SetPassword strPassword1
objUser.SetInfo

Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup)
Set objUser = GetObject("WinNT://" & strComputer & "/" & strUserName1)
objGroup.Add(objUser.ADsPath)
WScript.Echo objUser.Name & " created"
WScript.quit
'-------------END SCRIPT------------

Any thoughts?



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: September 17, 2008 at 04:49:21 Pacific
Reply:

Get rid of the Do or add a Loop.


0

Response Number 2
Name: MCowan
Date: September 17, 2008 at 05:24:46 Pacific
Reply:

That works. Thanks!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Creating a user account

Create a user profile in Visual C++? www.computing.net/answers/programming/create-a-user-profile-in-visual-c/1996.html

XP batch user account creation www.computing.net/answers/programming/xp-batch-user-account-creation/17360.html

scripting /win xp /noobish www.computing.net/answers/programming/scripting-win-xp-noobish/16335.html