Agent Orange Posted January 20, 2009 Posted January 20, 2009 I'm getting this an error line -1 running the below code. Any one tell me what is wrong with the expression?Thanks$Username=InputBox("Client Username","Please type the client username so it can be entered into the Power Users Group.","") $RET = RunWait(@ComSpec & " /c " & "net localgroup power users mydomain\"$username" /add",@WorkingDir, @SW_SHOW) MsgBox(64, "Result", "Return code was: " & $RET)
Pain Posted January 20, 2009 Posted January 20, 2009 From the helpfile.Runwait.Return ValueSuccess: Returns the exit code of the program that was run. Failure: Depends on RunErrorsFatal; see Remarks.
Developers Jos Posted January 20, 2009 Developers Posted January 20, 2009 (edited) You aren't getting -1 as returncode with the posted code since it contains syntax errors, unless you compile it first and then run it. Jos Edited January 20, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Pain Posted January 20, 2009 Posted January 20, 2009 Nvm, my bad. I didn't looked close enough.RunWait(@ComSpec & " /c " & "net localgroup power users mydomain\" & $username & " /add",@WorkingDir, @SW_SHOW)
Agent Orange Posted January 20, 2009 Author Posted January 20, 2009 Nvm, my bad. I didn't looked close enough.RunWait(@ComSpec & " /c " & "net localgroup power users mydomain\" & $username & " /add",@WorkingDir, @SW_SHOW)Thanks for the response. Still didn't work, I got a return code 2 this time.
Developers Jos Posted January 20, 2009 Developers Posted January 20, 2009 Thanks for the response. Still didn't work, I got a return code 2 this time.Did you try the command from the CMD prompt first to see if its valid?Pretty sure you will get an error SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Agent Orange Posted January 20, 2009 Author Posted January 20, 2009 Did you try the command from the CMD prompt first to see if its valid?Pretty sure you will get an error I did try it and the command works fine from a command prompt on the workstation. It successfully completes and when I go into the Power Users Group I see the user in there. I can delete the user from the group and run from a command line and it will readd it. If I try to run it from the AutoIt script I get the error 2 and no user is added to the group.Thanks
Developers Jos Posted January 20, 2009 Developers Posted January 20, 2009 I did try it and the command works fine from a command prompt on the workstation. It successfully completes and when I go into the Power Users Group I see the user in there. I can delete the user from the group and run from a command line and it will readd it. If I try to run it from the AutoIt script I get the error 2 and no user is added to the group.ThanksIt works for you without putting the groupname Power Users in double quotes? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Agent Orange Posted January 20, 2009 Author Posted January 20, 2009 It works for you without putting the groupname Power Users in double quotes?The command I'm running on the workstation is net localgroup "power users" domain\user /addI'm not sure the syntaxt for this when put into the autoit code line. The options I've tried cause an error
Developers Jos Posted January 20, 2009 Developers Posted January 20, 2009 (edited) The command I'm running on the workstation is net localgroup "power users" domain\user /add I'm not sure the syntaxt for this when put into the autoit code line. The options I've tried cause an errorThat is what I ment, you cannot just leave the double quotes, else the command line is not the same. Should be something like: RunWait(@ComSpec & ' /c net localgroup "power users" mydomain\' & $username & ' /add',@WorkingDir, @SW_SHOW) Edited January 20, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
walle Posted January 20, 2009 Posted January 20, 2009 (edited) Edit: Too slow Edited January 20, 2009 by walle
Developers Jos Posted January 20, 2009 Developers Posted January 20, 2009 Edit: Too slow and ... better check it too SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Agent Orange Posted January 20, 2009 Author Posted January 20, 2009 and ... better check it too That worked Jos....Thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now