Changing Local Administrator Account Password

by Jul 6, 2015

To access local user accounts and assign a new password, you can use the low-level WinNT: namespace.

Note: you do need Administrator privileges to assign new passwords.

This script would assign a new password for the local Administrator account:

#requires -Version 1
$Password = 'P@ssw0rd'

$admin = [adsi]("WinNT://$env:computername/administrator, user")
$admin.psbase.invoke('SetPassword', $Password)

Twitter This Tip! ReTweet this Tip!