This section is about cmdlets that are installed with the PowerShell module in Microsoft PowerShell Management.
Contains cmdlets that help you manage Windows in PowerShell.
Rename a PC
Rename-Computer
This cmdlet is only available on the Windows platform.
Rename-Computer renames the local computer or a remote computer.
Examples
example 1
Rename the local computer
This command renames the local computer to the new name CLI01 and then restarts it to make the change take effect.
Rename-Computer -NewName "CLI01" -DomainCredential mouslyacademy\Administrator -Restart
Example 2
Rename a remote computer
This command renames Srv01 to the new name Server001.
Rename-Computer -ComputerName "Srv01" -NewName "Server001" -DomainCredential Domain01\Admin01 -Force
The DomainCredential specifies the user who has permission to rename computers.
and Force specifies to confirm (Force) execution.