cmdcommand-linewindows-10rename

How to rename a Windows 10 machine using command line


I am tasked with renaming a couple of customers machines with new names. I would like to do it without interrupting the customers. We use DATTO remote system and can start a CMD prompt with the machine with admin privilege's without disturbing the user. The command I tried is below:

wmic ComputerSystem where "name='%ComputerName%'" call rename VS-R-REM-02
Invalid verb switch

I am getting this invalid verb switch error, anyone know how to fix? I don't think I have access to powershell without remoting in, just CMD.

Thanks,


Solution

  • If you haven't already to save yourself connecting to each computer individually you can write yourself a component either as a batch file or PowerShell script and run the newly created component as a job.

    PowerShell should be something along the lines of:

    Workstation:

    Rename-Computer -NewName "ComputerName" -LocalCredential localhostAdminUser
    

    Domain Joined:

    Rename-Computer -NewName "ComputerName" -DomainCredential DomainAdminUser
    

    If you want to know more about Rename-Computer cmdlet, check out this link: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/rename-computer?view=powershell-7.2&viewFallbackFrom=powershell-6