0

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

MathewC
  • 6,957
  • 9
  • 39
  • 53

2 Answers2

2

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.

Richard Slater
  • 3,228
  • 2
  • 30
  • 42
  • I'll check out psexec when I get back to work. No can do on the GP since I don't control it. Thanks. – MathewC Jun 10 '09 at 22:03
1

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
squillman
  • 37,883
  • 12
  • 92
  • 146
  • Does this set it for the local user on the remote machine? look like it's making this change in AD. – MathewC Jun 10 '09 at 22:05