Linton-StaffLaptops-RenameComputer
Jump to CustomersLinton > Linton > StaffLaptops > RenameComputer
Rename staff laptop without rebuilding
Before running this command you will need to know:
- Current name of the laptop
- New name for the laptop (please ensure that the new name for the laptop is not already in use)
- Local admin password (if using Powershell)
- Domain credentials
Using Powershell
Rename-Computer -ComputerName "<Current Name of the PC>" -NewName "<New Name For The PC>" -LocalCredential "<Current Name Of The PC>\administrator" -DomainCredential "linton\<Your Domain Username>" -Force -PassThru
- You can add the
-restart
switch on the end if the laptop is not in use - You will be prompted for both local admin and your domain password
- The laptop will need to be restarted before it leaves the site, in order for the active directory object to update
Using wmic
Changing the name via WMI means you don't need the local administrator password.
wmic computersystem where caption="<Current Name Of The PC>" rename "<New Name For The PC>"
Example
Using psexec to authenticate as the domain administrator and then renaming the laptop.
psexec -u LINTON\administrator \\lc-pw-new wmic computersystem where caption="LC-PW-NEW" rename "LC-PW"
PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com Password: Executing (\\LC-PW-NEW\ROOT\CIMV2:Win32_ComputerSystem.Name="LC-PW-NEW")->rename () Method execution successful. Out Parameters: instance of __PARAMETERS { ReturnValue = 0; }; WMIC exited on lc-pw-new with error code 0.