' Author
martin junge
' Version
0.1 - 16-7-2014
'
-----------------------------------------------'
Option
Explicit
Dim
objWMIService, objItem, colItems, strComputer, intPrinters
strComputer
= "."
intPrinters
= 1
dim strtemp,
strtemp1, strtemp2, strDrucker, strRegkey, WshShell
Set
objWMIService = GetObject _
("winmgmts:\\"
& strComputer & "\root\CIMV2")
Set colItems
= objWMIService.ExecQuery _
("SELECT
* FROM Win32_Printer")
On Error
Resume Next
For Each
objItem In colItems
if (instr(objItem.DriverName, "HP")) then
'WScript.Echo "Printer: " & objItem.DeviceID &
", " & objItem.DriverName
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
strDrucker = objItem.DeviceID
strtemp =
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\"
'----
strtemp1 = "\PrinterDriverData\SSNPNotifyEventSetting"
strRegkey = strtemp & strDrucker & strtemp1
'wscript.echo strRegkey
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite strRegkey, 0, "REG_DWORD"
'----
strtemp2 = "\PrinterDriverData\SSNPDisableAll"
strRegkey = strtemp & strDrucker & strtemp2
'wscript.echo strRegkey
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite strRegkey, 1, "REG_DWORD"
'----
end if
intPrinters
= intPrinters + 1
Next
WScript.Quit
' End of
Sample Printer VBScript