I think the syntax is "/expires:NEVER", which could explain why your
does appear to work.
Here's a VBScript that will check it (requires WMI, replace xxxxx
with the account name):
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32
_UserAccount where name='xxxxx'",,48)
For Each objItem in colItems
Wscript.Echo "For user " & objItem.Name & ", PasswordExpires is
set to " & objItem.PasswordExpires
Next
ws
--
The sea was angry that day, my friends. Like an old man, trying to
send back soup at a deli.
Everything seems to work in the command but the password
never expires check doesn't become checked off. I also
tried the same command line with the "/expires:NEVER" also
but it didn't work. I would like to check to see if the
change still took place but I know nothing about wmi or
vbscripts. Rockie when it comes to vbscripts. Thanks
>.
>
> I tried the "/expires:NEVER" also but it still doesn't add
> the check. Maybe I need to put it in a certain area of
> the net user command. Here is an example of my command
> line. net user testuser
> testpassword /add /expires:"never" /Comment:"Test
> Account" /FullName:"Tester" /passwordchg:"no"
Try doing it in two pieces. First actually create the account, then
once it exists make the other chnages. Used to be the case anyway.
Well, my reply never posted from the weekend...the "expires" with NET
USER sets the *account* to not expire, not the password. Google
around for some 3rd party command line utils for this.
ws
--
How much more black could this be? And the answer is, none. None more
black.
Oh. I mis-read your intent.
The PWD length and Expiration is global. See
net help accounts
PWD complexity is also global but AFAIK cannot be set using net.exe.
Actually, this "expires" option sets the ACCOUNT not to expire, not the
password. You can't control password expiration using NET USER.
There seem to be a lot of command line utils and VBScripts around to
address this. Do a Google search - there appear to be quite a few, and
you can choose the one that best suits your needs (sorry, I was going
to post some, but there are too many!)
ws
> Actually, this "expires" option sets the ACCOUNT not to expire, not the
> password. You can't control password expiration using NET USER.
>
> There seem to be a lot of command line utils and VBScripts around to
> address this. Do a Google search - there appear to be quite a few, and
> you can choose the one that best suits your needs (sorry, I was going
> to post some, but there are too many!)
Hi
Tip 570 at for a freeware command line tool (NETUSER.EXE):
http://www.jsiinc.com/reghack.htm
Example:
NETUSER.EXE someuser /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/community/scriptcenter/default.mspx
This sets the flag: CUSRMGR -u username -m \\machine +s
PasswordNeverExpires
This removes the flag: CUSRMGR -u username -m \\machine -s
PasswordNeverExpires
You can also set/remove the AccountLockout flag with this tool and a lot
more.
Rick
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:4057BB55...@hydro.com...