This little PowerShell module provides a simple way to change password of any user account if you know it. This is very useful for situations when you can't login to RDP
With this command you can change password of any user account, as long as you have password. The account can be service account and expired.
Set-MyPassword -UserName 'test'
With this command you can encrypt the password for use within a script.
Protect-MyPassword -UserName 'test'
With this command you can test if given login and password are valid.
Test-MyPassword
Blog post describing use cases: https://evotec.xyz/how-to-change-your-own-expired-password-when-you-cant-login-to-rdp/
Everyone can install this module from PowerShellGallery hosted by Microsoft. It's recommended way to work with the module. Version on PowershellGallery is optimized for speed and signed. Using code from GitHub is recommended for development.
Install-Module -Name PSMyPassword -AllowClobber -Force
Force and AllowClobber aren't necessary, but they do skip errors in case some appear.
Update-Module -Name PSMyPassword
That's it. Whenever there's a new version, you run the command, and you can enjoy it. Remember that you may need to close, reopen PowerShell session if you have already used module before updating it.
The essential thing is if something works for you on production, keep using it till you test the new version on a test computer. I do changes that may not be big, but big enough that auto-update may break your code. For example, small rename to a parameter and your code stops working! Be responsible!
- 0.0.4 - 2021.09.13