New Windows servers often come with a random name such as WIN-8F3K2LQ7ABC. A clear name, such as web01 or trading-vps, makes logs, Remote Desktop tabs and backups easier to read. Renaming takes one command and a restart, but a few apps remember the old name, so this guide also covers what to check afterwards.
Before you start
- Administrator access over Remote Desktop to
203.0.113.10:3389. - A good time for a restart. The new name only applies after a reboot.
- A new name that follows the rules:
- 15 characters or fewer.
- Letters, numbers and hyphens only. No spaces or underscores.
- Not only numbers.
Warning: Renaming requires a restart. Close running apps, such as trading terminals, and save your work first.
Check the current name
In PowerShell:
$env:COMPUTERNAMEOr run hostname in any command window. Note the old name. You will need it if SQL Server is installed.
Rename with PowerShell
Open PowerShell as Administrator and run:
Rename-Computer -NewName "web01" -Restart-Restart reboots straight away. Your Remote Desktop session drops. Wait two to three minutes, then reconnect to 203.0.113.10:3389.
To rename now and restart later, leave off -Restart. Windows shows a warning that the change takes effect after the next restart. Restart when you are ready:
Restart-ComputerRename with System Properties
- Press Win + R, type
sysdm.cpland press Enter. - On the Computer Name tab, click Change.
- Enter the new name in Computer name and click OK.
- Click OK on the restart notice, then Close.
- Choose Restart Now, or Restart Later if you need to finish something first.
On Windows Server you can also click the computer name under Local Server in Server Manager, which opens the same window. On Windows 10 or 11, Settings → System → About → Rename this PC does the same thing.
What the rename affects
Most apps do not care about the computer name. These do:
SQL Server
SQL Server stores the computer name it was installed under. After a rename, connections by the new name usually work, but @@SERVERNAME still returns the old name. That can break replication, maintenance plans and some jobs.
Check it in SQL Server Management Studio or sqlcmd:
SELECT @@SERVERNAME AS stored_name, SERVERPROPERTY('MachineName') AS machine_name;If the two differ, update the stored name. For a default instance:
EXEC sp_dropserver 'OLDNAME';
EXEC sp_addserver 'web01', 'local';For a named instance, such as SQL Server Express, include the instance name: 'OLDNAME\SQLEXPRESS' and 'web01\SQLEXPRESS'. Then restart the SQL Server service. Connection strings in your apps that use the old name also need updating.
Certificates
Certificates issued to the old computer name will not match the new one. This affects:
- Remote Desktop: expect a fresh certificate prompt the first time you connect after the rename. Accept it if the IP is yours. If you installed your own trusted RDP certificate for a hostname, it is not affected by the computer name.
- Internal certificates for apps that use the machine name, such as some web services. Reissue them with the new name.
Public certificates for a domain, such as example.com on IIS, are tied to the domain, not the computer name, so they keep working.
Other apps
- Licence managers and some trading or monitoring software bind licences to the computer name. Check with the vendor before renaming a licensed machine.
- Scripts, scheduled tasks and shortcuts that use
\\OLDNAME\sharepaths need updating. - Backup software may treat the renamed server as a new machine.
Check it works
After the restart, reconnect over Remote Desktop and run:
$env:COMPUTERNAMEIt should show the new name. If SQL Server is installed, run the @@SERVERNAME query again and confirm both columns match.
Troubleshooting
- "Skip computer rename because the new name is the same": the name is already set, or the rename is waiting for a restart. Restart and check again.
- "The computer name is not valid": remove spaces, underscores and special characters, and keep it to 15 characters.
- Can't connect after the restart: give Windows a few more minutes. If it still fails, open the browser console in your VPS provider's control panel to see whether Windows is still applying changes.
- An app stopped working: look for the old name in its configuration file, connection string or licence. Event Viewer often names the exact error.
Next steps
- Explore the main admin console: Server Manager tour for Windows Server beginners.
- Set up SQL Server properly: Install SQL Server Express.
