Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
SCOM monitor script for checking Internet Explorer ESC status. Requires something like the PowerShell script monitor MP by Wei Lim:
$API = New-Object -ComObject "MOM.ScriptAPI" -ErrorAction Stop
$PropertyBag = $API.CreatePropertyBag()
$Profiles = @{'Admin' = 0; 'User' = 0}
$Profiles.Admin = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}' -Name IsInstalled).IsInstalled
$Profiles.User = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}' -Name IsInstalled).IsInstalled
if ($Profiles.Values -contains 0)
$PropertyBag.AddValue('State', 1)
$API.LogScriptEvent("IEESCState.ps1", 1009, 0, "Internet Explorer Enhanced Security Configuration state is disabled for one or more profiles.")
$PropertyBag.AddValue('State', 0)
$API.LogScriptEvent("IEESCState.ps1", 1000, 0, "Internet Explorer Enhanced Security Configuration is enabled for all profiles.")
foreach ($key in $Profiles.Keys)
$PropertyBag.AddValue($key, $($Profiles.Item($key)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment