Batch file script for mapping printers with an exception

Hi, I'm new to using scripts.

I have a .bat file which runs as a logon script. I need to add some script in which does the following. I have some users with local printers, a network plotter, a black and white printer and a colour printer, both networked. I need to automatically change anyone's default printer if they have the colour printer set as the default and set it as the Black and White printer. If someone as the default as a local printer or the plotter then ignore it.

So I purely need a script to say If Colour Printer is set as default then set Black and White Printer as the default. Else ignore and don't change the default.

Can anyone help me? Thanks.

March 29th, 2015 4:17pm

set blackwhite=\\SERVER\BWPRINTER
cd C:\Windows\System32\Printing_Admin_Scripts\en-US
for /f "tokens=4*" %%i in ('cscript prnmngr.vbs -g ^|find "default printer"') do set default=%%j
if not "%default%" == "%blackwhite%" (cscript prnmngr.vbs -t -p "%blackwhite%")

Free Windows Admin Tool Kit Click here and download it now
March 29th, 2015 5:17pm

Thanks for the code Leif. I have tried running this and if the blackwhite is currently the default it ends the script as expected. I just edited the server\BWPRINTER to match the server and printer share name.

If I manually set the plotter as the default and run the script it defaults the black and white printer as the default. I would like this to ignore it and end the script.

The reason for this is that some users have the plotter as the default as they plot a lot of drawings. Anyone else needs to default to the black and white. This is for a money saving exercise as we spend a fortune on colour prints. 

March 30th, 2015 3:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics