Skip to content

Instantly share code, notes, and snippets.

@askvictor
askvictor / PapercutCheck.vbs
Created July 22, 2013 00:02
Due to the Papercut client crashing on some network conditions, the script can be triggered off Windows event ID 10000 to check if the client is connected to the work network. If so, and the papercut client isn't running, this will re-launch it.
'Trigger off event ID 10000 (Network Connected) to check if we're on the papercut network, and if
'PaperCut client is running. If it's not, try to start it.
strSearchSuffix = "REPLACE_WITH_DOMAIN_SUFFIX_TO_CHECK"
strFindProcessName = "pc-client.exe"
wscript.sleep 5000 'sleep 5 seconds to allow network to configure
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set objShell = CreateObject("WScript.Shell")