Jump to content

Reset password next logon


Recommended Posts

I am trying to find a way to force the user to reset the password on next logon..

I found a on how to do on a domain but the machines I am attempting to do this on are not on a domain..

I also found this on MSDN about the "set password" method.

when I try this I get an error

;setpassword
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$objWMIService = ObjGet("winmgmts:\\" & $host & "\MicrosoftIdentityIntegrationServer")
$Password = $objWMIService.ExecQuery("SELECT * from MIIS_CSObject where d account='test'", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

and also this

;setpassword
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$objWMIService = ObjGet("winmgmts:root\MicrosoftIdentityIntegrationServer")
$Password = $objWMIService.ExecQuery("SELECT * from MIIS_CSObject where d account='test'", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
Link to comment
Share on other sites

That can't work if you don't have MIIS installed. And if you don't have a domain, you don't have MIIS installed.

You can use a WMI user object to just set the PasswordExpired property:

$oUser.Put("PasswordExpired", 1)
$oUser.Setinfo()

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...