Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mpr-disable-enable.ps1
$query=New-XPathQuery -AttributeName DisplayName -Operator StartsWith "__MPR:"
$Expression=New-XPathExpression -ObjectType "ManagementPolicyRule" -QueryObject $query
$AllMPRs=Search-Resources $Expression
ForEach ($MPR in $AllMPRs)
{
$Resource=Get-Resource -ObjectType ManagementPolicyRule -AttributeName ObjectID -AttributeValue $MPR.ObjectID
$Resource.Disabled = "True"
#$Resource.Disabled = "False"
Save-Resource $Resource
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.