Powershell

Remotely rename a PC with Powershell

NordVPN

Do you need a quick and easy way to rename a computer that is joined to a domain remotely via Powershell? 

1. Enable "Windows Management Instrumentation" and "Remote Management" rules on your computers firewall. This can be done via Group Policy for multiple computers.
Note: If you don't enable WMI rules, you may get an error such as "Cannot establish WMI connection to computer. RPC server is not available."
2. Open cmd as an administrator and type powershell
3. Rename-computer –computername “testpc” –newname “newtestpc” -localcredential domain\user –domaincredential domain\user –force -passthru –restart

This command renames the testpc computer to newtestpc and then restarts it to make the change effective.
It uses:
- The localcredential parameter to supply the credentials of a user who has permission to connect to the local computer.
- The domaincredential parameter to supply the credentials of a user who has permission to rename computers in the domain.
- The force parameter will suppress the confirmation prompt.
- The passthru parameter will return the results of the command.
(Visited 1 times, 1 visits today)
No votes yet.
Please wait...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.