SynopsisRename the local or a remote computer.
- Rename-Computer [-ComputerName] [-NewName] [-Reboot] [-Credential]
DescriptionRename-Computer replaces the original Rename-Computer cmdlet found in pre-release Powershell 2 and is also usable against remote computers. Rename-Computer requires a reboot for the changes it makes to take effect and the -Reboot parameter of this cmdlet is included for this purpose.
It should be noted that Rename-Computer does not make checks as to the suitability of renaming the target computer and care should be taken when renaming computers running services that rely on a fixed computer name, such as Certificate Authorities.
- ComputerName The computer against which to run the cmdlet. By default this parameter will be populated with the name of the local computer.
- NewName The name to which the target computer should be renamed. Names longer than 15 characters will be rejected.
- Reboot Reboot the computer so that configuration changes take effect.
- Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.
InputsRename-Computer accepts pipeline input only for the ComputerName parameter and requires that the input object contain a property named either Computer, CN or ComputerName.
OutputsRename-Computer does not output any Powershell objects.
NotesThe cmdlet requires that the Remote Registry and RPC services are started on the computer it is trying to access and that DNS services are available to resolve target host names.
Example 1This command will rename the local computer to PC04 and reboot so that the changes take effect:
Rename-Computer -NewName PC04 -Reboot
Example 2This command will rename the remote computer PC01 to PC02.:
Rename-Computer -Computer PC01 -NewName PC02
Example 3This command will rename the local computer to PC02 and reboot so that the changes take effect:
Rename-Computer -Computer PC01 -NewName PC02 -Reboot -Confirm:$false