I've deployed BGInfo from SysInternals to all of our servers, both physical and virtual. However, a few of our servers have multiple hostnames to support "backward compatibility" with some of our legacy software systems after a server was replaced or its functions were merged with another server. In some cases, this may include several "alternate" hostnames that go back several years.
EXAMPLE:
Alternate Hostname (original computer): NT-PROD
Alternate Hostname (files/services merged from a retired server): NT-DATA
Alternate Hostname (hardware failure = new computer): PRODUCTION-07
Current Computer Name (physical server migrated to virtual): PRODUCTION-21
Using the basic WMIC
to get the computer name just returns the current name specified in the System Properties, while doing an NSLOOKUP
on the server's IP address apparently does the same thing. Is there a way I can actively retrieve all the DNS hostnames to which this specific server will respond for inclusion in my BGInfo wallpaper?
I suppose I could create a text file (or something) that BGInfo could check for alternate hostnames, but I'm trying to make this as "idiot-proof" as possible so I don't forget to update/apply any future DNS changes, or accidentally overwrite something with incorrect information. I readily admit that I'm not "fluent" in PowerShell scripts or more complex WMIC queries, but I would guess that's where we're headed.
Try
Resolve-DNSName <IP>
It should return all the names register to the server IPKeep in mind this will only work with your local zones. Not internet wide or any madness like that (See answers to https://stackoverflow.com/questions/31539904/get-all-dns-records-associated-with-an-ip for more on that)