Skip to content

Instantly share code, notes, and snippets.

@davegreen
Created January 27, 2016 17:07
Show Gist options
  • Save davegreen/622c9e417a1e200a5c8e to your computer and use it in GitHub Desktop.
Save davegreen/622c9e417a1e200a5c8e to your computer and use it in GitHub Desktop.
SCOM monitor script for checking Internet Explorer ESC status. Requires something like the PowerShell script monitor MP by Wei Lim: https://gallery.technet.microsoft.com/Sample-Management-Pack-17b76379
$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.")
}
else
{
$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)))
}
$PropertyBag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment