Sets the password of accountname passed to it as argument to never expire.
'SetPwToNeverExpire.vbs 'Thanks to Biber http://www.administrator.de/index.php?content=37803 '20060811, v1, Biber. '20110319, v2. ' Copy and paste of script from mentioned URL with some style modifications. '20200909, v3. ' Use the COMPUTERNAME as the computer to use in GetObject. ' Remove the extra "/." after strWorkGroupOrDomain so that it works on Windows 10 ' and Server 2016/2019 without throwing an 0x80005000 error. Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000 strUser = Wscript.Arguments(0) ' Parameter 1 Username Set wshShell = CreateObject( "WScript.Shell" ) strWorkgroupOrDomain = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) Set objUser = GetObject("WinNT://" & strWorkgroupOrDomain & "/" & strUser & ",User") objUserFlags = objUser.Get("UserFlags") objPasswordExpirationFlag = objUserFlags OR ADS_UF_DONT_EXPIRE_PASSWD objUser.Put "userFlags", objPasswordExpirationFlag objUser.SetInfo Set objUser = Nothing
'SetPwToNeverExpire.vbs 'Met dank aan Biber http://www.administrator.de/index.php?content=37803 '20060811, v1, Biber. '20110319, v2. ' Copy and paste of script from mentioned URL with some style modifications. Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000 strWorkgroupOrDomain = "Workgroupname" strUser = Wscript.Arguments(0) ' Parameter 1 Username Set objUser = GetObject("WinNT://" & strWorkgroupOrDomain & "/./" & strUser & ",User") objUserFlags = objUser.Get("UserFlags") objPasswordExpirationFlag = objUserFlags OR ADS_UF_DONT_EXPIRE_PASSWD objUser.Put "userFlags", objPasswordExpirationFlag objUser.SetInfo Set objUser = Nothing
Source: administrator - -Password Expires NEVER- per CMD festlegen? WinXP Pro