Install Printer via Hostname

Hey everyone. I’m new with this powershell and am looking for a little help on this one.

I want to write a script that lets my users install their printer by typing the desired printer’s hostname and it would do it’s thing. The only thing the user has access to is the hostname “ABC-XXX” where XXX is a 3 digit number. The driver is the same and already on their computer “HP Universal…Driver” I can ping the printer using the hostname and I’m just curious on how you’d take the IP from the ping and install the printer. Right now, I just do it for them manually. I run the primitive script below.

Add-PrinterPort -Name “ABC-012” -PrinterHostAddress “xx.xxx.xxx.x”

Add-Printer -DriverName “HP UNIVERSAL DRIVER” -Name ABC-012 -PortName ABC-012

submitted by /u/Big_D_yup
[link] [comments]

Leave a Reply