Detect printer installed exist using RUNDLL32 in Windows XP / 7
Dear Sir,
We would like to write a script to detect whether existing Windows has a printer installed with name "Printer1". I am planning to use RUNDLL32 printui.dll,PrintUIEntry command to do it. If Printer1 name exists, it will skip
next step of driver installation.
However, I cannot found the correct command do the detection.
I try this command:
rundll32 printui.dll,PrintUIEntry /Xg /n "Printer1"
I found that if printer1 exist, it will show properties. If it is not exist, it will show error.
0x00000709.
What additional command can I use this for driver detection?
Joe
September 28th, 2011 7:20am
Hi,
Thank you for your question.
I am trying to involve someone familiar with this topic to further look at this issue.
Regards,
Leo
Huang
TechNet
Subscriber Support in forum. If you have any feedback on our support, please contact
tngfb@microsoft.comPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
October 11th, 2011 8:53pm
Hi,
does the reg query work for you?
reg query "hkcu\Software\Microsoft\Windows NT\CurrentVersion\Devices"Ketan Thakkar | Microsoft Online Community Support
October 16th, 2011 12:56am
Dear Ket,
I have asked software company to write a VBS script on it.
strPrinter ="Microsoft XPS Document Writer"
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer where name = '" & strPrinter & "'")
If colPrinters.Count <> 0 Then
wscript.echo "Printer driver has been installed already"
else
Set oShell = CreateObject("WScript.Shell")
oShell.Run "C:\windows\notepad.exe"
End If
It should work properly on driver detection.
Thanks,
Joe
Free Windows Admin Tool Kit Click here and download it now
October 16th, 2011 1:56am