Skip to content

Instantly share code, notes, and snippets.

@jkbryan
Created October 2, 2018 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkbryan/3fd2d5a1e304ae39620990022a1174a2 to your computer and use it in GitHub Desktop.
Save jkbryan/3fd2d5a1e304ae39620990022a1174a2 to your computer and use it in GitHub Desktop.
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