NET USER with Shell.Run? 
Author Message
 NET USER with Shell.Run?

I am trying to do a script to setup a machine at install, and I am having
problems with the user setup. I am using this:
objWshShell.run "net user jeanette /ADD password:Adm1n /expires:never"

And the user is created, but the /expires:never part gets ignored. It seems
to get ignored when I use this at the command line too, so maybe it is a
WinXP problem, but I figure this is the place to get that answer too.
Assuming I can't use NET USER, is there an easy way to do this? I don't
really want to get into all the crazy code of WMI. I only need to create a
few users on a few machines, so I am only looking at saving a few minutes of
time at most, making it not worth the time to write and test the WMI stuff.
I was hoping Shell.Run would work, but perhaps not.

Best,
Gordon



Sat, 17 Sep 2005 10:50:36 GMT  
 NET USER with Shell.Run?

Quote:

> I am trying to do a script to setup a machine at install, and I am having
> problems with the user setup. I am using this:
> objWshShell.run "net user jeanette /ADD password:Adm1n /expires:never"

> And the user is created, but the /expires:never part gets ignored. It seems
> to get ignored when I use this at the command line too, so maybe it is a
> WinXP problem, but I figure this is the place to get that answer too.
> Assuming I can't use NET USER, is there an easy way to do this?

Hi

/expires:never sets the *account* to never expire (that is the default anyway),
but I guess you want to set the "Password never expires" flag?. If that is the
case:

Tip 570 at for a freeware command line tool (NETUSER.EXE):
http://www.jsiinc.com/reghack.htm

This should then do it:

net user jeanette /ADD password:Adm1n
NETUSER.EXE jeanette /pwnexp:y

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Sat, 17 Sep 2005 23:38:25 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. run net.exe (net send) with external commands

2. Run .NET script code and handle .NET events from inside IE with VsaControl

3. difference between Shell.run and Shell.exec

4. nt4 shell.run: unable to run .exe in netlogon

5. Starting a c#.net window app (no UI) using window script host shell

6. Win2K/Net user group enumeration with LDAP?

7. Mapping Net Drives with User Permission

8. Net User

9. NET USER

10. net user?

11. IE setting for all net users

12. Net User Command

 

 
Powered by phpBB® Forum Software