/build/static/layout/Breadcrumb_cap_w.png

Help with script installing printers on 32-bit systems

I am having trouble getting the script below to run on 32-bit XP and 2003 systems when pushed from the K1000. However, if I run it from a batch file saved to c:\ it runs with no issues. The printer port gets created and the print spooler restarts, but the command prompt windows doesn't popup and rundll32 does not run. On the Win7 64-bit machines I have tested it on, it runs with no issues and the cmd windows appears and displays the proper echo messages when pushed from the K1000. I tried changing it from offline kscript to online kscript. As an online script I have tried it using both local system and run as using domain admin credentials.

I am using the most recent version for the K1000 and agent.

Any help would be greatly appreciated. Thanks

@echo off
echo The printer drivers are installing. This window will close when complete. Do NOT close manually or install will not complete.
echo ---------
echo Creating printer port
IF EXIST "C:\Windows\System32\Printing_Admin_Scripts\en-US" GOTO :Win7
cscript %windir%\system32\prnport.vbs -a -r IP_10.10.1.6 -h 10.10.1.6 -o raw -n 9100
GOTO :Install
:Win7
cscript %windir%\system32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r IP_10.10.1.6 -h 10.10.1.6 -o raw -n 9100
:Install

echo Restarting Print Spooler
net stop spooler && net start spooler

if "%programfiles(x86)%"=="%programfiles(x86)%" goto 32BIT
echo Installing 64-bit drivers
rundll32 printui.dll,PrintUIEntry /if /b "SK01 Copier" /f "\\skmgmthou\software\Printer Drivers\Canon iR3245\UFRII\64-bit\CNLB0UA64.INF" /r "IP_10.10.1.6" /m "Canon iR3235/iR3245 UFR II" /z

goto END

:32BIT
echo Installing 32-bit drivers
rundll32 %windir%\system32\printui.dll,PrintUIEntry /if /b "SK01 Copier" /f "\\skmgmthou\software\Printer Drivers\Canon iR3245\UFRII\32-bit\CNLB0U.INF" /r "IP_10.10.1.6" /m "Canon iR3235/iR3245 UFR II" /z

:END
exit

1 Comment   [ + ] Show comment
  • I have modifed the script. I am deploying this on a workgroup system running Windows 7 64-bit. It errors out at Installing 64-bit drivers... - akilpatrick 10 years ago

Answers (5)

Answer Summary:
I found a solution...since the file runs locally, I attached the the .bat file as a dependency and then use launch a program to run it from the dependency folder on the pc. This allows it to run successfully on XP, 2003, and 7, either x86 or x64. I gave pjgeutjens and Tentacle Master credit for helping with the answer since they both helped me to correct the scripting.
Posted by: RandomITPro 12 years ago
4th Degree Black Belt
4
pjgeutjens is correct,

your use of GOTO commands are incorrect. it should be GOTO Win7 not GOTO :Win7.

Also,
if "%programfiles(x86)%"=="%programfiles(x86)%" goto 32BIT is an incorrect method to check for architecture, it will always be true.

Instead use IF "%PROCESSOR_ARCHITECTURE%"=="x86" GOTO 32BIT

Comments:
  • Thanks for architecture variable, I couldn't find it. My original script had the line read if "%programfiles(x86)%XXX"=="XXX" goto 32BIT, but I changed it to what you said. I also corrected GOTO commands. However, it still stops running after the services are restarted and works fine if ran locally instead of being pushed. - jcantello 12 years ago
Posted by: pjgeutjens 12 years ago
Red Belt
2
2 remarks:

I dunno if you copy/pasted the script, but your use of GOTO is inconsistent. You sometimes use the colon in the goto command, which I don't think is the way it should be.
So not GOTO :Win7 but GOTO Win7

Second, I'm pretty sure your condition if "%programfiles(x86)%"=="%programfiles(x86)%" is not as it should be... this will always evaluate true if I'm not mistaken. I think it should be if "%programfiles(x86)%"==""

PJ
Posted by: jcantello 12 years ago
White Belt
1
I found a solution...since the file runs locally, I attached the the .bat file as a dependency and then use launch a program to run it from the dependency folder on the pc. This allows it to run successfully on XP, 2003, and 7, either x86 or x64. I gave pjgeutjens and Tentacle Master credit for helping with the answer since they both helped me to correct the scripting.
Posted by: snissen 12 years ago
Fourth Degree Green Belt
0
I haven't used this in a while, but it worked on both Windows 7 and XP (both 32-bit), with the 5.0 and 5.1 KBOX agents. I copied this line from the raw XML editor:



Sande

Comments:
  • Well, shoot, the line won't paste unless I remove some delimiters:

    launch_program path="$(KBOX_SYS_DIR)" program="cscript.exe" wait="true" parms="//B //Nologo //T:30 "$(KACE_DEPENDENCY_DIR)\prnport.vbs" -a -r IP_137.22.251.251 -h 137.22.251.251 -o raw -n 9100" - snissen 12 years ago
Posted by: dugullett 12 years ago
Red Belt
-1
What about run as user logged in? I have a similiar script that only works as logged in user.

Comments:
  • Did not change anything. Thanks - jcantello 12 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
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