Batch File Question
I am creating a batch file to add printers to users in our domain and am hitting a slight snag in the lines.
Here is the batch file for one of our user profiles:
-------------------------------------------------------------------------
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-MAINT-2035n"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-ACCT-HP9000uni"
rundll32 printui.dll,PrintUIEntry /y /in /n "\\PRNTSVR01\P1-AEDE-5500pcl"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-LAB-PANA8060pcl"
-------------------------------------------------------------------------
From what I've read about the switches, '/y' should set that printer to the default printer. Though when I go back to look at the final results, all printers in the file have been added and the selected printer was not set to the default printer.
Any idea as to how or to fix this or why it did not work? Any answers would be appreciated.
DAS-03590
Junior Poster in Training
60 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Well, we are looking at having this done through group policy and we found that the batch file shown was an easier way for us to control who gets what printer. Also if the printer has to be installed first before that '/y' switch will work, then what would we be able to use to change that?
The computers for users are primarily Windows XP and we are currently switching to Windows 7 as we replace older units. But this batch file works on both OS's all it requires is the correct driver for that printer to be available.
DAS-03590
Junior Poster in Training
60 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Sorry, I seem to found the answer to my primary question...
Incorrect Batch File:
-------------------------------------------------------------------------
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-MAINT-2035n"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-ACCT-HP9000uni"
rundll32 printui.dll,PrintUIEntry /y /in /n "\\PRNTSVR01\P1-AEDE-5500pcl"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-LAB-PANA8060pcl"
-------------------------------------------------------------------------
Correct Batch File
-------------------------------------------------------------------------
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-MAINT-2035n"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-ACCT-HP9000uni"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-AEDE-5500pcl"
rundll32 printui.dll,PrintUIEntry /y /n "\\PRNTSVR01\P1-AEDE-5500pcl"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-LAB-PANA8060pcl"
-------------------------------------------------------------------------
This actually set the required printer to the default printer. So it seems you have to install the printer first then run a new command to make the desired printer become the default. My credits to 'rch1231', you mentioned about installing the printer first. That got me thinking on the file and so i found the answer within a few minutes. Bad news that Microsoft's Help Command doesn't make that disclaimer. Nor do any of the webpages I found.
DAS-03590
Junior Poster in Training
60 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Sorry, I seem to found the answer to my primary question...
Incorrect Batch File:
-------------------------------------------------------------------------
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-MAINT-2035n"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-ACCT-HP9000uni"
rundll32 printui.dll,PrintUIEntry /y /in /n "\\PRNTSVR01\P1-AEDE-5500pcl"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-LAB-PANA8060pcl"
-------------------------------------------------------------------------
Correct Batch File
-------------------------------------------------------------------------
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-MAINT-2035n"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-ACCT-HP9000uni"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-AEDE-5500pcl"
rundll32 printui.dll,PrintUIEntry /y /n "\\PRNTSVR01\P1-AEDE-5500pcl"
rundll32 printui.dll,PrintUIEntry /in /n "\\PRNTSVR01\P1-LAB-PANA8060pcl"
-------------------------------------------------------------------------
This actually set the required printer to the default printer. So it seems you have to install the printer first then run a new command to make the desired printer become the default. My credits to 'rch1231', you mentioned about installing the printer first. That got me thinking on the file and so i found the answer within a few minutes. Bad news that Microsoft's Help Command doesn't make that disclaimer. Nor do any of the webpages I found.
DAS-03590
Junior Poster in Training
60 posts since May 2010
Reputation Points: 10
Solved Threads: 0