共用方式為


Netdom computername

 

Applies To: Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows 8

Manages the primary and alternate names for a computer. This command can safely rename Active Directory domain controllers as well as member servers.

Netdom is a command-line tool that is built into Windows Server 2008and Windows Server 2008 R2. It is available if you have the Active Directory Domain Services (AD DS) server role installed. It is also available if you install the Active Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (https://go.microsoft.com/fwlink/?LinkID=177813).

To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

netdom computername <Computer> [usero:<User> [/passwordo:[<Password>|*]] [userd:<User> [/passwordd:[<Password>|*]] {/add:<NewAltDNSName> | /remove:<AltDNSName> | /makeprimary:<ComputerDNSName> | /enumerate[:{ALTERNATENAMES | PRIMARYNAME | ALLNAMES}] | /verify | {/help | /?}}

Parameters

Parameter

Description

<Computer>

Specifies the name of the computer that you want to add.

/usero:[<domain>\]<UserName>

Specifies the user account that you want to use for the originating domain.

/passwordo:[<Password> | *]

Specifies the password that you want to use for the originating domain. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.

/userd:[<Domain\]<UserName>

Specifies the user account that you want to use for the destination domain.

/passwordd:[<Password> | *]

Specifies the password that you want to use for the destination domain. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password..

/add:<NewAltDNSName>

Specifies to create a new alternate name. You must specify a fully qualified domain name, which is the computer name followed by the primary Domain Name System (DNS) suffix, such as comp1.example.com.

/remove:<AltDNSName>

Specifies to delete an existing alternate name. You must specify fully qualified domain name, which is the computer name followed by the primary DNS suffix, such as comp1.example.com.

/makeprimary:<ComputerDNSName>

Specifies to make an existing alternate name into the primary name. You must specify a fully qualified domain name, which is the computer name followed by the primary DNS suffix, such as comp1.example.com.

/enumerate[:{ALTERNATENAMES | PRIMARYNAME | ALLNAMES}]

Lists the primary name or any alternate names. You can specify any of the following values:

  • ALTERNATENAMES: Lists the alternate names only.

  • PRIMARYNAME: Lists the primary name only.

  • ALLNAMES: Lists the primary and any alternate names. This is the default.

/verify

Checks if there is a DNS record and a service principal name (SPN) for each computer name.

{/help | /?}

Displays help at the command prompt.

Examples

To give an alternate name for the domain controller DC in the example.com domain, use the following syntax:

netdom computername dc /add:altDC.example.com

Before you can make a name the primary name of a computer, that name must exist as an alternate.

To rename the domain controller DC to altDC in the example.com domain, type the following command at the command prompt:

netdom computername dc /makeprimary:altdc.example.com

To rename a member server, you must use one of the existing alternate names for the computer as the new primary name.

Additional references

Command-Line Syntax Key

Netdom

Netdom add

Netdom join

Netdom move

Netdom query

Netdom remove

Netdom movent4bdc

Netdom renamecomputer

Netdom reset

Netdom resetpwd

Netdom trust

Netdom verify