This tutorial shows how to make your DNS server contain up-to-date DNS CNAME values, according to which workstation the user is logged in.

Example: User foo uses Windows station bar. The administrator would like to access his PC for doing some tasks via VNC, SMB etc. As it is more comfortable to lease DHCP IPs to workstations and users might often change their workstations, it would be quite useful to have a CNAME foo.yourdomain.local to quickly access the right computer.

Note: The solution below is not a useful way for every local network, as it could be used improperly, e.g. important existing DNS CNAMEs could be overwritten. So make sure you can trust your local users not to use it for improper tasks.

  1. Create a network share which every user has write access to, e.g. \\myserver\user_pc
  2. In the Windows group policy object of your choice, add a startup script “user_pc.bat” with this content:

  3. (The second line is optional, but it may be useful)
  4. Test it; you should get text files as soon as users log on.
  5. Download dnsupdater and place it into a directory, e.g. on your domain controller.
  6. Edit the config file: Enter the path where the text files are created and updated, your local domain name, etc.
  7. Run the .exe file and watch your DNS server entries. The application watches the textfile directory. When a file gets new content, it updates the CNAME entry on the server.
  8. If it works, you can run the .exe as a Windows service, e.g. with NSSM

Note: Dots in Windows usernames like “firstname.lastname” are removed for the CNAME entry (“firstnamelastname.yourdomain.local”).

 

Share This:

  [email protected]