Sign in to follow this  
Followers 0
cowsmanaut

Net User command

9 posts in this topic

#1 ·  Posted (edited)

Run(@ComSpec & "net user " & $name & " " & $pass & " /add /PASSWORDCHG:NO /PASSWORDREQ:YES /EXPIRES:NEVER") 
Run(@ComSpec & "netuser " & $name & " /pwnexp:y")
Run(@ComSpec & "net localgroup administrators " & $name & " /add")

I can not seem to get this to work. I can get the input fromthe user and I've tried a simple test where I enter a dos command into an input box and pass it through comspec as a $var. It worked fine.. but now I try it with this and I get

line 14 (file "C:\..blah blah .au3)

Run(@Comspec & "net user" & ... etc etc etc")

Error: Unable to execute the external program

The system cannot find the file specified.

I even tried runwait..

tried also run(@compsec & "/c net user" & blah blah blah...

No result.. but if I type it in from the commandline myself.. it works.. :D

here's hoping someone sees with fresh eyes what I did wrong???

edit missed the & after comspec

Edited by cowsmanaut

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It doesn't look like any of your examples included a space after the @ComSpec macro. Remember that this is just a link to the command interperter on your system, so you need a space. It should read Run(@ComSpec & " /c " & $stuff) or whatever you need. Just make sure there is a space after the @ComSpec.

Fixed my BB code

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

there is a space.. however, that's apparently not the issue..

I've just been told by a friend that it's likely it cannot find the path to the command.. ACK!!! I thought Net was a native command

can I do multiple lines with comspec with the @CR command? Since now I'll need to Setpath z:/bin etc etc..

moo

Edited by cowsmanaut

Share this post


Link to post
Share on other sites

If you just need to set a directory, use the 2nd paramater of Run:

Run(@ComSpec & " /c " & $program, $directory, @SW_HIDE)

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

well now I'm seriously confused.. because it seems like maybe Net is a native command.. can anyone let me know?

windows XP pro.

I will say I can run it from a batch file easily enough and it works.. but I'd rather do it this way so I can take the input..

moo

Share this post


Link to post
Share on other sites

Looks like it is. This worked for me:

Run(@ComSpec & " /k net view")

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Run(@ComSpec & " /k net user /?")

worked for me too.. UGH..

$name = inputbox ("Enter your name", "Enter the name you wish to use to log in")

do
$pass = inputbox ("password", "enter the password you wish to use. Remember it" ,"", "*")
$passB = inputbox ("password", "Type your password once more" ,"", "*") 
if $pass = $passB then
    msgbox (0, "thank you", "Thank you " & $name & "your account will now be created")
else
    msgbox (0, "Error", "That was not the same password, please renter your password")
endif
until $pass = $passB 
    

Runwait(@ComSpec & " /k net user " & $name & " " & $pass & " /add /PASSWORDCHG:NO /PASSWORDREQ:YES /EXPIRES:NEVER")

it now appears to work.. perhaps now that I've typed it out myself a few hundred times??

Share this post


Link to post
Share on other sites

Let's just blame that Murphy guy and his forsaken law :D


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

yeah, must be. I even tried restarting and running it again and it still works fine.. how messed up is that. :D

anyway, You have to wonder how a machine based up on mathimatical operations like 1+1=2 can some times give you 1+1=3???

sun spots.. magnetic feilds... slight twitch in the earths orbit?

Thank you very much as usual for your patience :huh2:

moo

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0