yakk0.org a blog on technology in the real world

8Mar/102

PowerShell: Add printers to DNS

I realized today that most of our printers at work did not have DNS entries. This isn’t a big problem for users because they’re on our print server and they get their printers through Group Policy. The Print server has each printer set up to the IPs. We just implemented a management system today, and it lists the printers by IP and because the DNS entries were “Unknown” for most of them, it wasn’t easy to determine what printer we were looking at.

I found several PowerShell examples on the web for interacting with Microsoft DNS servers, and took a bit from each to come up with this script. It takes the shared printer name and publishes that as the DNS name. This does cause a problem if you have spaces in a share name, but our environment doesn’t, so I didn’t program for that issue.

Here’s the script: