Rename local computer to W8M1 and restart
The above command works with Powershell 3.0. For Powershell 2.0, below can be used on an elevated privileges.
Using WMIC to rename a computer
References:
http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/c9dcf26a-5476-4199-8311-b101c969a47a/
http://blogs.technet.com/b/askds/archive/2009/02/19/renaming-a-computer-using-wmic-and-how-to-get-around-that-aggravating-invalid-global-switch-error.aspx
PS D:\> Rename-Computer -NewName W8M1 -Restart
PS D:\> $computer = Get-WmiObject Win32_ComputerSystem -ComputerName <old_name> PS D:\> $computer.Rename("<new_name>") PS D:\> $os = Get-WmiObject Win32_OperatingSystem PS D:\> $os.psbase.Scope.Options.EnablePrivileges = $true PS D:\> $os.Reboot()
Using WMIC to rename a computer
D:\> WMIC ComputerSystem where Name="%computername%" call Rename Name=NewName
References:
http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/c9dcf26a-5476-4199-8311-b101c969a47a/
http://blogs.technet.com/b/askds/archive/2009/02/19/renaming-a-computer-using-wmic-and-how-to-get-around-that-aggravating-invalid-global-switch-error.aspx
Comments