Created
July 17, 2013 16:27
-
-
Save Erreinion/6022157 to your computer and use it in GitHub Desktop.
Rename local user account
http://stackoverflow.com/questions/5188917/powershells-script-to-re-name-local-guest-administrator-account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$user = Get-WMIObject Win32_UserAccount -Filter "Name='$oldName'" | |
$result = $user.Rename($newName) | |
if ($result.ReturnValue -eq 0) { | |
return $user | |
# you may just print a message here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment