Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Last active January 22, 2016 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomfanning/900868106ebe9ba2aa92 to your computer and use it in GitHub Desktop.
Save tomfanning/900868106ebe9ba2aa92 to your computer and use it in GitHub Desktop.
Rename Windows administrator
$admin=[adsi]"WinNT://./oldname,user"
$admin.psbase.rename("newname")
#$admin.SetPassword("")
$admin.CommitChanges()
$admin=[adsi]"WinNT://./vagrant,user"
$admin.psbase.rename("Administrator")
#$admin.SetPassword("")
$admin.CommitChanges()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment