Windows 11 Community

Cover image for Fix: "The PC name is invalid" Error in Windows 11
Muhammed Cetin
Muhammed Cetin

Posted on • Updated on

Fix: "The PC name is invalid" Error in Windows 11

In this tutorial, I'll explain how to fix the The PC name is invalid error when changing your PC Name or PC Host Name in Windows 11.

Since I've faced the same error when creating the renaming guide for Windows 11, and I was able to fix it by following some methods, I believe I can show you the most effective solutions. 😉

Before starting, please read the instructions below. Then, follow the solution steps respectively.

Table of Contents

  1. Need to Know
  2. Update Windows 11
  3. Turn off Sync and Detach Your PC from Microsoft Account
  4. Rename via PowerShell
  5. Conclusion

Need to Know

  • Make sure you've logged in as an administrator. Otherwise, you cannot rename your PC.

  • Your PC name is not only related to your PC. When it joins a network, other network members have to identify or access your PC when needed. Because there might be old PCs with the previous versions of Windows, such as Windows 7, Vista, or XP in your network, your PC name needs to be compatible with them. So;

  • Don't use spaces and** lowercase letters** because some Windows versions may not support them.

  • Don't use special characters like ~ @ # $ % ^ & ( ) = + [ ] { } | ; : , ‘ “ . < > / \ ?

  • Your PC name cannot consist of only numbers. For example, 1234567 cannot be a PC name.

  • Keep your PC name to 15 characters or less. Even if Windows 11 allows naming longer than 15 characters, compatibility issues may occur with some apps and services like NETBIOS.

  • Choose a unique name. There cannot be multiple devices in a network with the same name. If you're not part of a network, you don't have to worry about it. 😊


1. Update Windows 11

  1. Sometimes, the waiting updates might prevent renaming your PC. So, you need to check for updates and install them. To do that:
    Open Start Menu, and type "Check for updates". Then click on it on the search results.
    Open Check for updates tool

  2. Click Check for updates and wait.
    Check for updates

  3. If there is an available update, you'll see them in this window after searching is done. Install them and reboot your PC.


2. Turn off Sync and Detach Your PC from Microsoft Account

If you use your PC with your Microsoft account, your Windows 11 settings are stored in it and synchronized with your other devices.

This is so cool and useful for Windows 11 users, but when you're trying to rename your PC, this might cause some errors like ours. Thus, we need to turn off Sync.

  1. Open Start Menu and type "Sync your settings" and click on it on the search results.
    Open Sync your settings tool

  2. You'll see Remember my apps and Remember my preferences setting groups like in the image below. Turn off both of them. You don't need to worry about your synchronized settings because you can turn on them after renaming your PC.
    Turn off Sync settings

  3. Reboot your PC and remove it from your Microsoft account, as I've explained here (How to Remove Your PC from Your Microsoft Account).

  4. Try to rename with the same way. If the error persists, follow the 3rd step below.


3. Rename via PowerShell

Windows PowerShell with administrator privileges is a powerful tool to rename PC in Windows 11. In my case, it has allowed me to overcome the "name is invalid" error.

  1. Open Start Menu and type "PowerShell". Then focus on Windows PowerShell result by moving your cursor. You'll see the running options on the right side. Click Run as Administrator option.
    Run Windows PowerShell as Administrator

  2. Windows 11 will ask for confirmation. Click Yes.

  3. Copy and paste the command below to PowerShell and change the "NEW-PC-NAME" term with your new name without removing quotes. Then press Enter.

    Rename-Computer -NewName "NEW-PC-NAME"

  4. For example, if you want to name your PC "MCE7IN", your command will be Rename-Computer -NewName "MCE7IN".
    Rename-Computer Command

  5. You'll see a message like that: "The changes will take effect after you restart the computer OLD-PC-NAME.". Restart your PC as PowerShell says.
    Restart your PC

  6. Your PC name has been changed successfully. Congratulations! 👏


Conclusion

If you followed all the steps above carefully, you should have changed your computer name easily. However, please inform me by using the discussion form below if you still encounter the same error.

Discussion (0)