Installing printers based on computer names.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
penyel
Newbie
Posts: 3
Joined: Fri Jan 12, 2007 4:32 pm

Installing printers based on computer names.

Post by penyel » Wed Jan 17, 2007 5:32 pm

The following script intends to install printers and set defaults based on computer names, So far the logic works sometimes, but I encounter the following error when I execute the script on workstations for the first time "Error - Missing Else/ENDIF". Printers get installed and then another error shows "Operation could not be completed"

Let me also reiterate that the help so far received has been crucial to this project. Thanks a million for the feedback.

Let>SYSTEM_lISTA=JOBRIEN;BOCONNELL;JZIDES;KMARTIN;JMELLON;MGARBER;DHOPKINS;JPERLOW;BOSSPARE3945;LLETENDRE1;EPEREZ
Position>COMPUTER_NAME,SYSTEM_LISTA,1,Inlist
If>Inlist>0
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\7thfloor
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\7thfloorNewArea
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\BostonAdmin
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\7thfloor
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\7thfloorNewArea
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\LaserJet4050
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /y /n \\10.11.0.8\7thFloorNewArea

Else
Let>SYSTEM_LISTB=BOSSPARE3288;MONSTERPC-BOS;BOSSPARE3929;BOSSPARE3269;BOSSPARE-3942
Position>COMPUTER_NAME,SYSTEM_LISTB,1,Inlist
If>Inlist>0
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\7thfloor
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\7thfloorNewArea
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\BostonAdmin
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\7thfloor
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\7thfloorNewArea
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\LaserJet4050
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /y /n \\10.11.0.8\7thfloor

Else
Let>SYSTEM_LISTC=BOSSPARE3288;MONSTERPC-BOS;BOSSPARE3929;BOSSPARE3269;BOSSPARE-3942;DEACCOMP
Position>COMPUTER_NAME,SYSTEM_LISTC,1,Inlist
If>Inlist>0
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\7thfloor
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\7thfloorNewArea
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /dn /q /n \\cpasb\BostonAdmin
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\7thfloor
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\7thfloorNewArea
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /in /q /n \\BOS-Printers\LaserJet4050
run>C:\Windows\System32\rundll32 printui.dll,PrintUIEntry /y /n \\10.11.0.8\LaserJet4050
EndIF

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jan 17, 2007 6:33 pm

You have two missing Endif liness.

Count your Ifs. You have three. But you have only one Endif.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts