Run a cmd line from a link or bat to install a network printer
I'm looking for a way to automate the installation of newtwork printers. I would like to have a list of printers in a knowledge base item that the end user can click on a name and the printer will install. We have our users move around the building alot.
I can install the printer via cmd "rundll32 printui.dll PrintUIEntry /in /n\\server\printer"
Can i create a html doc to put in the knowledge base, with the printer name that is a 'hyperlink' of sorta that will run this cmd line?
Or even point it back to a .bat that lives on the server with that cmd line.
Thanks for the help
Answers (2)
You could create an Online script to do it. Then create a new item in the user portal (service desk>software library) for the user to click. You can even get creative and restrict it to labels based location/user so they do not see unnecessary printers.
Comments:
-
Hint: PrintUI commands to add printers fail if a printer with the same name already exists. I find it useful to preface each printui add command with one or more printui delete commands. Or you could use WMIC to query existing printers to figure out what needs to be removed, but that's more work. - snissen 11 years ago
Create a cmd with a question for the user and place a shortcut on the desktop for every user.
Script could look like this:
@Echo off :Question Rem # Ask user for his choice. Cls Echo. Echo ///////////////////////////////////////////////////////////////////////////// Echo // Add a printer // Echo ///////////////////////////////////////////////////////////////////////////// Echo. Echo Press 1 to connect to the xxx printers Echo The following UK Printers will be added: Echo (PRT-XX1 PRTXX2) Echo. Echo Press 2 to connect to the xx2 printers Echo The following DE Printers will be added: Echo (PRT-XX1 PRTXX2) Echo. Echo Press 3 to connect to the xx3 printers Echo The following US Printers will be added: Echo (PRT-XX1 PRTXX2) Echo. Echo Press 4 to connect to the xx4 printers Echo (PRT-XX1 PRTXX2) Echo. Echo Press E for EXIT Echo Nothing will be done and this window will close. Echo. Echo. Choice /C 1234E /M "What's your choice?" If %errorlevel% == 0 Goto Question If %errorlevel% == 1 Goto UK If %errorlevel% == 2 Goto DE If %errorlevel% == 3 Goto US If %errorlevel% == 4 Goto ESP If %errorlevel% == 5 Goto End If %errorlevel% == 255 Goto Question
:UK Rem # Connect to UK Printers rundll32 printui.dll PrintUIEntry /in /n\\server\printer :DE Rem # Connect to DE Printers rundll32 printui.dll PrintUIEntry /in /n\\server\printer :US Rem # Connect to US Printers rundll32 printui.dll PrintUIEntry /in /n\\server\printer etc.... :End Rem # Exit the Script EXIT
Comments:
-
The Software library as a script is the best method. If you do this as a KB article the user would need local admin rights. - cblake 11 years ago