Set-LocalAdmin Function

Enable or disable a local admin account. Defaults to "Administrator" user but you can specify other admin users. Without parameters runs in report mode. Returns information on current state, prior state, action taken, last logon date, password last set date, and password expiration date.

See help for more details on usage:
Get-Help Set-LocalAdmin

Source Code

This script has not been checked by Spiceworks. Please understand the risks before using it.