I'm using
Net user username /passwordreq:yes
but I need to do this on a bunch of machines. I can run a batch through SCCM, but would like to do it with a script. Anyone have a way to do this?
Thanks! -Mathew
I'm using
Net user username /passwordreq:yes
but I need to do this on a bunch of machines. I can run a batch through SCCM, but would like to do it with a script. Anyone have a way to do this?
Thanks! -Mathew
If all of the computers are turned on:
Download and install PSExec, create a file with each of your workstations on a line of their own, you can do this with Active Directory users and Computers search quite easily. Then run the following command:
psexec @filename.txt -s net user username /passwordreq:yes
If the computers are not turned on:
put
net user username /passwordreq:yes
into a .cmd file and add it as a computer startup script in Group Policy - this is pretty much the same thing as using SCCM.
If you want a script, here's a quick VBS script that should do it for you:
Const ADS_UF_PASSWD_NOTREQD = &H0020
strDCHostName = "myDC" 'Change this value to the name of your domain controller
strUserName = "jsmith" 'Change this value to the username in question
set objUser = GetObject("WinNT://" & strDCHostName & "/" & strUserName)
objPwdNotRequiredFlag = objUserFlags AND NOT ADS_UF_PASSWD_NOTREQD
objuser.put "userFlags",objPwdNotRequiredFlag
objUser.SetInfo