Wednesday, 20 August 2014

VBS - disable all HP printers notifications / popups


' 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

5 comments:

  1. Thank you for the info. It sounds pretty user friendly. I guess I’ll pick one up for fun. thank u.

    Support for 123 HP Printers

    ReplyDelete
  2. A very interesting article. The insights are really helpful and informative. Thanks for posting.
    123 HP Officejet Pro Setup 8736

    ReplyDelete
  3. thanks for your informative post.its helpful to understand it.keep blogging
    hp officejet pro 8736 printer

    ReplyDelete
  4. Hey, nice site you have here! Keep up the excellent work!


    123 HP Install

    ReplyDelete