Kaseya
From GreyWiki
Scripting Notes
Proto Scripts
Deploy An IP Printer
We have the means to deploy a TCP/IP networked printer, as long as we have drivers available on a share that we can copy locally and as long as it's actually using the standard IP_#.#.#.# port connection. Here's the bare bones of it:
cscript C:\WINDOWS\system32\prnport.vbs -a -r IP_192.168.XX.YY -h 192.168.XX.YY -o raw mkdir #vAgentConfiguration.agentTempDir#\printdrivers xcopy "\\server-name\Installs\Printers\Printer Driver Directory" #vAgentConfiguration.agentTempDir#\printdrivers /Y /H /Q /E rundll32 printui.dll,PrintUIEntry /if /b "Pretty Name" /f #vAgentConfiguration.agentTempDir#\printdrivers\driver.inf /r "IP_192.168.XX.YY" /m "Model String"
What we'll do to make this portable:
- Prompt for the IP address, use that variable three times (twice in the first command, once in the last).
- Prompt for the driver source UNC path
- Clean the print driver directory at the end of the script in case we do a different printer later.
- Prompt for the display name, used in the last step.
- Prompt for the INF file, used in the last step.
- Prompt for the model string, used in the last step. Since we'll have to prep the server UNC share anyway, pulling this out of the INF isn't exactly going to be a horribly difficult step.
- Put in some error-catching & notification code.