Export management pack XML from SquaredUp PowerShell tile

Hi Kenneth

As you’ve already worked out. This is happening because the application pool account SquaredUp uses doesn’t have permissions to export management packs. You could get around this by creating a new PowerShell profile in SquaredUp and assigning a user with the correct permissions. Export-SCOMManagementPack requires a user that is a member of the ‘Operations Manager Administrators’ role.

This feels like far too much permission to me. It might be better to access the MP elements directly rather than exporting to XML first. You could do something like…

$Group = Get-SCOMGroup -Id '6f7e3306-beeb-2996-3795-7c1eafb925b8' # 'All Windows Computers'
$DiscoveryXML = [XML]($Group.GetMonitoringDiscoveries().createnavigator() | Select -ExpandProperty outerxml)
$DiscoveryXML.Discovery.DataSource.MembershipRules.MembershipRule

To access the membership rules as XML. You should then be able to use the same code to parse the XML as you are already using and the profile user would only need to be a member of ‘Operations Manager Advanced Operators’

Hope that helps