FILE: C:\ProgramData\PuppetLabs\puppet\var\lib\facter\sm_ver_check.rb
--
Facter.add("smartermail_version") do
confine :osfamily => "windows"
setcode do
powershell = 'C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -NoProfile'
command = 'if($(Test-Path ${env:ProgramFiles(x86)}\SmarterTools\SmarterMail\Service\MailService.exe -ErrorAction SilentlyContinue) -eq $True){$(Get-Item ${env:ProgramFiles(x86)}\SmarterTools\SmarterMail\Service\MailService.exe).VersionInfo.FileMajorPart}'
Facter::Util::Resolution.exec(%Q{#{powershell} -command "#{command}"})
end
end
--