Applies To: Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Vista

ComputerName specifies the computer name used to access the computer from the network.


If ComputerName is missing, you must enter a computer name during OOBE.

If ComputerName is set to an asterisk (*) or is an empty string, a random computer name will be generated. This random name has at most eight characters from the RegisteredOwner and/or RegisteredOrganization strings plus random characters.

ComputerName is a string with a maximum length of 15 bytes of content:

  • ComputerName can use ASCII characters (1 byte each) and/or multi-byte characters such as Kanji, so long as you do not exceed 15 bytes of content.

  • ComputerName cannot use spaces or any of the following characters: { | } ~ [ \ ] ^ ' : ; < = > ? @ ! " # $ % ` ( ) + / . , * &, or contain any spaces.

  • ComputerName cannot use some non-standard characters, such as emoji.

Computer names that cannot be validated through the DnsValidateName function cannot be used, for example, computer names that only contain numbers (0-9). For more information, see the DnsValidateName function.


  • In Windows® 8 and Windows Server® 2012, computer names are no longer appended by an OEM string.

  • In Windows® 7, Windows Vista®, Windows Server® 2008 R2, and Windows Server® 2008, computer names can be customized by OEMs and by corporate customers. They can append a string that is up to five bytes long to the customer-chosen computer name.

    If you do not customize this string, "-PC" is appended to the customer-chosen computer name. In some languages, "-PC" is localized and the resulting string might be more than five bytes. When this occurs, the computer-name string is truncated and this truncation may result in a nonsense string appended to the computer name.

    To avoid this situation, OEMs and corporate customers should provide an appending string in an Oobe.xml file.

  • Valid Configuration Passes


    Parent Hierarchy

    Microsoft-Windows-Shell-Setup | ComputerName

    Applies To

    For a list of the Windows editions and architectures that this component supports, see Microsoft-Windows-Shell-Setup.

    XML Example

    The following XML output shows how to set the computer name.


    See Also