Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
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

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
share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.