Renaming a Windows Computer from the Command Line
- 
 Windows includes a very handy PowerShell commandlet for renaming a computer. The most simple form is to rename the local machine, rarely would we want to rename a remote one although that is supported as well. After renaming a machine, a reboot is necessary for the change to take effect. Rename-Computer myservername Restart-ComputerThat's it. When the computer comes back up, it will have the new Hostname and NetBIOS name. 
 An alternative restart command would be: shutdown /r /c "Renamed Machine"
- 
 Oh, you can do that even on remote machines, either by Enter-PSSession or Invoke-* or by using Rename-Computer's -ComputerName parameter 
- 
 And btw, you are using a PowerShell command in the first place, why not rebooting that machine using a PowerShell cmdlet in this case? Restart-Computer -Force -Timeout 0
- 
 @thwr updated to reflect 
- 
 @scottalanmiller Oh, cool. Just thought it would make more sense 
- 
 I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it. 
- 
 @IRJ said in Renaming a Windows Computer from the Command Line: I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it. shutdown doesn't do the renaming, you just have to reboot after you rename. 
- 
 @scottalanmiller said in Renaming a Windows Computer from the Command Line: @IRJ said in Renaming a Windows Computer from the Command Line: I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it. shutdown doesn't do the renaming, you just have to reboot after you rename. I use "m" instead of c for computer name 
- 
 @IRJ said in Renaming a Windows Computer from the Command Line: @scottalanmiller said in Renaming a Windows Computer from the Command Line: @IRJ said in Renaming a Windows Computer from the Command Line: I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it. shutdown doesn't do the renaming, you just have to reboot after you rename. I use "m" instead of c for computer name /c is the comment for the logs to tell them that you just "Renamed Machine", it doesn't rename it, it literally puts "Renamed Machine" into the reboot logs. 
- 
 @scottalanmiller said in Renaming a Windows Computer from the Command Line: @IRJ said in Renaming a Windows Computer from the Command Line: @scottalanmiller said in Renaming a Windows Computer from the Command Line: @IRJ said in Renaming a Windows Computer from the Command Line: I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it. shutdown doesn't do the renaming, you just have to reboot after you rename. I use "m" instead of c for computer name /c is the comment for the logs to tell them that you just "Renamed Machine", it doesn't rename it, it literally puts "Renamed Machine" into the reboot logs. Ok. Got ya. 


