/build/static/layout/Breadcrumb_cap_w.png

Script Standard TCP/IP Port and Driver Install

I’m trying to create a script that will do two things.
1-create a standard TCP/IP port to be used for a printer
2-install the driver from a network share
To get started I referenced this KKE:
https://kace.webex.com/kace/lsr.php?AT=pb&SP=TC&rID=64233532&rKey=ad55c2e92fca23c2&act=pb
That gave me some idea, but it did not go over an example for me to follow, so I'm still trying to figure out whats needed.

I installed the printer on a clean machine and exported keys from the registry and placed the exported reg files on a network share.
Reg keys exported were:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Drivers\Version-3\Xerox WorkCentre 7345 PCL6
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\x.x.x.x
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\Xerox 7345
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Xerox 7345

When the script runs, I get the pop-up that says stuff will happen, and the ‘run now’ logs say success.
Checking the system, there is no printer, no port, and I don’t know where to check to see if the driver files were installed.
The share is accessible to everyone.
The script runs as local system and looks like this on the KBOX:
TASK 1
Remediation
1 - Launch “C:\Windows\System32\rundll32” with params “printui.dll,PrintUIEntry /ia /m ”Xerox WorkCentre 7345 PCL6“ /f ”\\shareserver\Drivers\Printers\Xerox\WorkCentre_7345\x64\x2GPINX.inf“”.
2 - Launch “C:\Windows\System32\regedit.exe” with params “/s /i \\shareserver\Drivers\KACE\PrintReg\1_Driver_Xerox_7345.reg”.
3 - Launch “C:\Windows\System32\regedit.exe” with params “/s /i \\shareserver\Drivers\KACE\PrintReg\2_Ports_Xerox_7345.reg”.
4 - Launch “C:\Windows\System32\regedit.exe” with params “/s /i \\shareserver\Drivers\KACE\PrintReg\3a_Printer_Xerox_7345.reg”.
5 - Launch “C:\Windows\System32\regedit.exe” with params “/s /i \\shareserver\Drivers\KACE\PrintReg\3b_Printer_Xerox_7345.reg”.
6 - Stop service “Print Spooler”.
7 - Start service “Print Spooler”.

If there is anyone currently using the KBOX to create a standard TCP/IP port and install a printer, I would appreciate a dumbed down step by step.
Can someone tell me what I'm doing wrong?

0 Comments   [ + ] Show comments

Answers (8)

Answer Summary:
From Scripting > Add New Item > selected "Online Shell Script" > ticked “Enabled†> ticked “Pick Specific OS Versions:†(because this was for a specific OS) > ticked “Run As User logged in to console†(because the testing was done with an account that had admin) > then just pasted the two previously mentioned commands into the “Script Text:†section: cscript C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnport.vbs -a -r IP_192.168.1.12 -h 192.168.1.12 -o raw -n 9100 printui.dll,PrintUIEntry /if /b "Xerox7345" /f "\\ShareServer\Drivers\Printers\Xerox\WorkCentre_7345\x64\x2GPINX.inf" /r "IP_192.168.1.12" /m "Xerox WorkCentre 7345 PCL6"
Posted by: MichAda 12 years ago
Orange Belt
2
Just in case there is someone out there that’s as much a newbie as I am, here is what I did (with the help of support) to get this working.
Messy?...probably. Works?…yelp.

From Scripting > Add New Item > selected "Online Shell Script" > ticked “Enabled” > ticked “Pick Specific OS Versions:” (because this was for a specific OS) > ticked “Run As User logged in to console” (because the testing was done with an account that had admin) > then just pasted the two previously mentioned commands into the “Script Text:” section:

cscript C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnport.vbs -a -r IP_192.168.1.12 -h 192.168.1.12 -o raw -n 9100

printui.dll,PrintUIEntry /if /b "Xerox7345" /f "\\ShareServer\Drivers\Printers\Xerox\WorkCentre_7345\x64\x2GPINX.inf" /r "IP_192.168.1.12" /m "Xerox WorkCentre 7345 PCL6"

Just need to modify the account being used and maybe build in some other stuff into the script...in a few years.
Posted by: WGM_Jeff 12 years ago
4th Degree Black Belt
1
I just got this going here. This is what I used. You will have to have the driver files copied locally to the computer. You could zip them up and add as a dependency for the script.

First you create the port:
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnp
ort.vbs -a -r [port name] -h [IP Address of the printer]

Next install the driver:
C:\Windows\System32\Printing_Admin_Scripts\en-US\prnd
rvr.vbs -a -m "[Driver Name]" -h [Path to the folder the driver is in] -i [Path to the the inf file]

Then add the printer:
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnm
ngr.vbs -a -p "[Printer Name]" -m "[Driver Name]" -r [Port Name]

This worked for me. Hope it helps.
Posted by: pjgeutjens 12 years ago
Red Belt
0
Michael,

you should look into using the Printing Administration Scripts that come with Windows. More specifically for these tasks I think you need prnmngr.vbs and prnport.vbs.
They reside in the <SystemRoot>\System32 folder on XP and in <SystemRoot>\System32\Printing_Admin_Scripts\en-US\ on Vista and Windows 7.

I've not used KBOX personally, but they should be easy enough to call from your scripts.

PJ
Posted by: MichAda 12 years ago
Orange Belt
0
I did not realize those were local. I saw some information on those scripts, but it sounded like we would have to push them to the client...so we scrapped the idea.
Found mine in C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US.
Any pointers to some documentation on how to use those...for a none scripter/programer?
Posted by: MichAda 12 years ago
Orange Belt
0
Thanks for the links...looks pretty interesting...especially if you already script:)
Posted by: MichAda 12 years ago
Orange Belt
0
So, I guess step one should be to get the driver installed.
Created a 'bat' file that I think will call the prndrvr.vbs with the needed perameters. Apparently my string is wrong, because the cmd window only returns the switches/options. The contents of the bat file is below:

echo
cscript C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prndrvr.vbs -ai "\\ShareServer\Printers\Xerox\WorkCentre_7345\x64\x2GPINX.inf“ -m ”Xerox WorkCentre 7345 PCL6“
pause

I also tred to use:
cscript C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prndrvr.vbs -a -m ”Xerox WorkCentre 7345 PCL6“ -v 3 -h "\\ShareServer\Drivers\Printers\Xerox\WorkCentre_7345\x64\" -i x2GPINX.inf

Anyone know what is wrong with either of the commands?
Posted by: MichAda 12 years ago
Orange Belt
0
It seems a tiny bit of progress has been made.
I created two batch files, if that is what you want to call it.
1 for the standard tcpip port, and 1 for the driver.

The “port” batch file, calls “prnport.vbs” (thanks again pjgeutjens for the ms-link) with parameters as listed below.
cscript C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnport.vbs -a -r IP_192.168.1.12 -h 192.168.1.12 -o raw -n 9100

The “driver” batch file, calls “rundll32” with these parameters:
printui.dll,PrintUIEntry /if /b "Xerox7345" /f "\\ShareServer\Drivers\Printers\Xerox\WorkCentre_7345\x64\x2GPINX.inf" /r "IP_192.168.1.12" /m "Xerox WorkCentre 7345 PCL6"

With the batch files locally on a computer, they are successful. So…Now all I need to do is figure out how to put that same information into the K1100.

Can someone advise?
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ