Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How to close a property page programmatically (script user clicking OK or CANCEL)

$
0
0

I have a need to call the PRINTUI.DLL from a PowerShell script. (Windows Server 2008 R2). The problem is that PRINTUI.DLL is opening a property sheet and waiting for the user to click OK or CANCEL to close the property sheet. I need a way to force the OK or CANCEL and let the script to continue -- not wait. Note: I do not care if it is OK or CANCEL, either will work.

There does not seem to be anything in RUNDLL32.EXE to force this and I am limited by the available options provided by PRINTUI.DLL.  Here is an example command I want to issue from my PowerShell script:

RUNDLL32 PRINTUI.DLL PrintUIEntry /p /c\\PRTSRV03 /nMBPRT07Q

Any tricks to code this in PowerShell so when PRINTUI.DLL opens and suspends (waiting on user) I can either force close the called PRINTUI.DLL?

(Someone may well want to know why? Opening PRINTUI.DLL properties (the "/p" argument) for a shared printer ("/n" argument) on a print server ("/c" argument) causes the print driver to initialize. In this case I will select printers that use a Ricoh universal print driver. The Ricoh universal print driver interrogates the printer hardware and loads printer capabilities (does it staple, what paper trays available, can it duplex or staple, etc.) into the driver. This is a necessary step on the print server so that end-user's printer connections to the server have the correct information available in the driver when they connect.)


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>