Solved

Can I run PrintUI.DLL silently via login script?

Posted on 2014-01-23
3
1,456 Views
Last Modified: 2014-01-23
Here is my situation: I need to remove network shared printers from client computers. The printers were originally shared from a SBS03 box, but the SBS03 box is no longer on the network. AD and printer sharing has been taken over by a 2008r2 box. The problem is that many computers still have a connection to the printers shared from the SBS03 box. I have the following commands in my login script:
rundll32 printui.dll,PrintUIEntry /dn /n\\OLD_SERVER\PRINTER1
rundll32 printui.dll,PrintUIEntry /dn /n\\OLD_SERVER\PRINTER2

This is working well, but here is the snag: Every login after the first, the users get an error that states:

"Printer connection cannot be removed. Double check the printer name and make sure that the printer is connected to the network."

Is there a way to suppress messages from PrintUI.DLL or force it to run silently?

Thank you!
0
Comment
Question by:FuelSupport
3 Comments
 
LVL 12

Assisted Solution

by:mlongoh
mlongoh earned 100 total points
ID: 39803362
You can write a vbscript to run these two commands silently:

Set wsShell = CreateObject("wscript.shell")
wsShell.Run "rundll32 printui.dll,PrintUIEntry /dn /n\\OLD_SERVER\PRINTER1", 0, True
wsShell.Run "rundll32 printui.dll,PrintUIEntry /dn /n\\OLD_SERVER\PRINTER2", 0, True


Save the script as DelPrn.vbs, and set your logon script to run this script.
0
 
LVL 13

Accepted Solution

by:
Felix Leven earned 400 total points
ID: 39803364
/q quiet mode, do not display error messages
0
 

Author Closing Comment

by:FuelSupport
ID: 39805229
/Q is what I was looking for. Thank you!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now