简体   繁体   中英

How to change & verify hostname in windows server 2012 (AWS EC2)

I am using Windows Server 2012-R2 (amazon ec2) machine.

and I want to change and verify hostname in it. I checked on net and found hostname command. But when I run hostname or hostname -i command I get following error..

sethostname: Use the Network Control Panel Applet to set hostname.

hostname -s is not supported.

I further googled this problem and apparently this command is not usable on windows 2012-r2 servers. Is there any alternative or workaround command that can do the job for me??

On windows the computer name is also often referred to as hostname. However this creates some confusion. Some people use the term hostname to refer to the leftmost part of domain name which can only be set on a DNS server. However another meaning of a hostname is just an arbitrary label assigned to a machine on a computer network, and this can be directly changed on the specific machine.

There are several ways to change the computer name from the command line on windows 2012:

Method 1. Open cmd and type:

    SCONFIG and you will get selection menu where #2 says Computer Name:

Method 2. From cmd type:

    netdom renamecomputer %computername% /newname:<NewName> /reboot:0

Method 3. From the PowerShell console:

    netdom renamecomputer $env:computername /newname:<NewName> /reboot:0

To verify the name form cmd type:

    nbtstat -A xxx.xxx.xxx.xxx (where x is the ip address)

Another way to verify the name form cmd just type "hostname" without any parameters:

    hostname

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM