Local Password Management Form

localpasswordmgmt I’m very happy to see PrimalForms spreading in popularity and acceptance. One topic I come across is the need for more samples, and of course, I’m happy to oblige.

I put together a short form script to manage local account passwords. While the form is loading, the current domain is queried using a DirectorySearcher object for all computer accounts. These accounts are used to populate the computer combo box control.

The script defaults to the current computer and uses ADSI to get all local user accounts. These accounts are used to populate the user combo box control. By first user account is selected and the status bar will show the account’s password age in days. Select a different user and the status bar will be updated. Pick a new computer from the drop down and the user list will be repopulated.

You can use this form to change the password for the select account. Enter a new password, it is masked by default but you could comment out that line if you preferred to see what you are typing, then click the Change Password button.

This is a very simple solution. There is no error handling, prompting or warning. Because of that I must stress that you need to test in a non-production environment.

Even if you don’t need the form for it’s original intent, it serves as demonstration on how to populate and clear a combo box control, how to call one script block from another and how to use the status bar control.

If you have problems with this or your own PrimalForms or PowerShell project, please feel welcome to use the forums at ScriptingAnswers.com.

Download a zip file with the pff and ps1 files here.

Enjoy!