FILE: C:\ProgramData\PuppetLabs\puppet\var\lib\facter\sophosservicecheck.rb

--
sophos_check = { "agent" => "Sophos` Agent", "antivirus" => "SAVService", "statusreporter" => "SAVAdminService", "autoupdate" => "Sophos` AutoUpdate` Service", "messagerouter" => "Sophos` Message` Router", "systemprotection" => "sophossps", "webcontrol" => "Sophos` Web` Control` Service", "webfilter" => "swi_filter", "webintellegence" => "swi_service" } sophos_check.each {|key, value| Facter.add("sophosservice_#{key}") { confine :osfamily => "windows" setcode { powershell = 'C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -NoProfile' command = "write-host (Get-Service #{value} -ComputerName localhost -ErrorAction SilentlyContinue).count" Facter::Util::Resolution.exec(%Q{#{powershell} -command "#{command}"}) } } }
--