Reset Sitecore admin password and account

I recently managed to lock out my Sitecore local admin account when using the Sitecore PowerShell module. It did this without warning when the elevated privileges stopped working correctly.

Anyway from a few various sources I found some examples of how to reset the password. But what was required was to also to set IsLockedOut value.

If you ever find your account locked out, try running the following.