Keep Track of Roaming Users

With DNS and the Dnscmd tool, you can easily keep tracking of which machines roaming users are logged on to.


May 29, 2006

2 Min Read
ITPro Today logo

When you have many roaming users, you often need to know which computer a user is logged on to. Trying to have a user find a computer name inside the OS or on a small label (which is often missing) placed somewhere on the computer isn't always an easy task. As a result, this task is often time consuming. And sometimes you just want to know what computer a user is logged on to without having to speak to the user.

Fortunately, there's an alternative. You can use a simple command to get a computer name from a username, then ping that user's machine to see whether the user is logged on. DNS and the Dnscmd tool make this possible. You can find Dnscmd in the SupportTools directory of your Windows OS CDROM. You can run this tool on any Windows Server 2003, Windows XP, or Windows 2000 machine.

Using Dnscmd, you can get a user's initials registered in DNS with the computer name the user logs on to. In our DNS, I created a domain named users under the domain forward lookup zone (e.g., Now I can use Dnscmd to register an alias, or CNAME, resource record for a user when the user logs on. I use the Dnscmd command with the /recordadd switch and CNAME option, which follows the syntax

dnscmd [ServerName]
  /recordadd ZoneName
  NodeName CNAME 

In this syntax, ServerName specifies the DNS server's name. ZoneName and NodeName specify the name of the zone and node, respectively, that contain the record.
Host|DomainName specifies the Fully Qualified Domain Name (FQDN) of the DNS host and domain that you want to add to that record. For example, for a roaming user with the initials XXX who logs on to a computer called PC1, the command

dnscmd MyDNSServer
  %username% .users CNAME
  %computername% .%userdnsdomain% 

creates a CNAME entry named XXX under the newly created users. This entry contains the FQDN

Now that there's an alias registered for the user, you can type

ping -a or  ping -a XXX.users 

to ping the user's computer to see whether the person is logged on.

To delete this record when the user logs off, you can use the /recorddelete switch with the CNAME option in the command

dnscmd MyDNSServer  /recorddelete
  %username%.%users CNAME
  %computername%.%userdnsdomain% /f 

I've implemented these commands as logon and logoff scripts in Group Policy Objects (GPOs). I'm now able to easily keep track of which machines that roaming users are logged on to.

About the Author(s)

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like