How to Use PowerShell to Check Your MPR Configuration for FIM Portal Access
FIM ScriptBox Item
Summary
Note
Please see this post for more details.
Script Code
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 |
#---------------------------------------------------------------------------------------------------------- set-variable -name URI -value "http://localhost:5725/resourcemanagementservice" -option constant #---------------------------------------------------------------------------------------------------------- if(@(get-pssnapin | where-object {$_.Name -eq "FIMAutomation"} ).count -eq 0) {add-pssnapin FIMAutomation} $mprNames = @() $mprNames += ”General: Users can read non-administrative configuration resources” $mprNames += “User management: Users can read attributes of their own” #---------------------------------------------------------------------------------------------------------- write-host "Checking MPRs" write-host "=============" foreach($mprName in $mprNames) { write-host $mprName $curMpr = export-fimconfig -uri "http://localhost:5725/resourcemanagementservice" ` -customconfig ("/ManagementPolicyRule[DisplayName='$mprName']") ` –onlyBaseResources ` -ErrorVariable Err ` -ErrorAction SilentlyContinue if($Err) {throw $Err} if($curMpr -eq $null) {throw "MPR not found!"} $isDisabled = $curMpr.ResourceManagementObject.ResourceManagementAttributes | ` Where-Object {$_.AttributeName -eq "Disabled"} if($isDisabled.Value -eq $true) {write-host "Enabled: No`n" -foregroundcolor yellow -backgroundcolor black} else {write-host "Enabled: Yes`n"} } write-host "`nCommand completed successfully`n" #---------------------------------------------------------------------------------------------------------- trap { Write-Host "`nError: $($_.Exception.Message)`n" -foregroundcolor white -backgroundcolor darkred Exit 1 } #---------------------------------------------------------------------------------------------------------- |
Note
To provide feedback about this script, create a post on the FIM TechNet Forum.
For more FIM related Windows PowerShell scripts, see the FIM ScriptBox.