Edit local user account remotely: set passwordreq:yes

7,528

Solution 1

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.

Solution 2

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:
7,528

Related videos on Youtube

Madhu Cheluvaraju
Author by

Madhu Cheluvaraju

I put this in here to get the autobiographer badge. I'm sure you understand, and am technically not cheating as you now know what kind of person I am.

Updated on September 17, 2022

Comments

  • Madhu Cheluvaraju
    Madhu Cheluvaraju over 1 year

    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

  • Madhu Cheluvaraju
    Madhu Cheluvaraju almost 15 years
    I'll check out psexec when I get back to work. No can do on the GP since I don't control it. Thanks.
  • Madhu Cheluvaraju
    Madhu Cheluvaraju almost 15 years
    Does this set it for the local user on the remote machine? look like it's making this change in AD.