To force a user to change their password at next logon, you could use the following VBScript:
Dim usr Set usr = GetObject("WinNT://NetBIOSDomainName/UserLogonName,user") usr.Put "PasswordExpired", CLng(1) usr.SetInfoWhere:
NetBIOSDomainName is the NetBIOS Domain Name, like JSIINC. UserLogonName is the user logon name, like Jerry.NOTE: To clear the User must change password at next logon flag, change CLng(1) to CLng(0).
I have scripted MCPANL.bat to force a user to change their password at next logon.
The syntax for using MCPANL.bat is:
\[Call\] MCPANL NetBIOSDomainName UserLogonName
MCPANL.bat contains:
@echo off if \{%2\}==\{\} @echo Syntax: MCPANL NetBIOSDomainName UserLogonName&goto :EOF setlocal set dom=%1 set usr=%2 if exist "%TEMP%\MCPANL.VBS" goto doit @echo.Dim usr, objArguments>"%TEMP%\MCPANL.VBS" @echo set objArguments = Wscript.Arguments>>"%TEMP%\MCPANL.VBS" @echo dom=objArguments(0)>>"%TEMP%\MCPANL.VBS" @echo un=objArguments(1)>>"%TEMP%\MCPANL.VBS" @echo ldp = "WinNT://" ^& dom ^& "/" ^& un ^& ",user">>"%TEMP%\MCPANL.VBS" @echo Set usr = GetObject(ldp)>>"%TEMP%\MCPANL.VBS" @echo usr.Put "PasswordExpired", CLng(1)>>"%TEMP%\MCPANL.VBS" @echo usr.SetInfo>>"%TEMP%\MCPANL.VBS" :doit cscript //nologo "%TEMP%\MCPANL.VBS" %dom% %usr% endlocal
0 comments
Hide comments