Naming your computer is almost as exciting as naming your baby or new puppy. Almost. However, it shouldn’t have to be as difficult.
Whether you recently purchased a new computer, or upgraded from a previous version to Windows 10 (and the name you assigned your computer didn’t make it through the upgrade), this script will help you easily rename the computer.
Not to mention, if you’re an MSP or IT professional managing a ton of devices, renaming them in a systematic way will certainly help you keep track of all the devices you monitor and maintain on a monthly basis.
This script changes the system hostname and restarts the computer automatically. The hostname is changed both locally and over the network.
This script will work for both a local and remote computer, hopefully making your work life a little easier.
The Script:
Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *
# Chanage the computer name in Windows
Rename-Computer -newname "$HQ-MikeC-PC"
# Restart the computer for rename to take effect
if ($ToRestartTypeYes -eq 'yes') {
Restart-Computer -Force
}
Technical Notes:
1. The computer will restart automatically for the changes to take effect.
2. This script uses a variable named $HQ-MikeC-PC to specify the computer name. If this variable does not contain a value, or is not inherited from another source, this script may produce unexpected results.
3. This script will result in changing the computer name as seen in Active Directory. This may require rejoining or other interaction from an administrator after running this script.