FIM Portals: Use PowerShell to Find all Users Without a Manager

Finding all users without a manager: Xpath Filters

/Person[not(Manager=/Person)]
or,
/Person[Manager!=/Set[DisplayName='All People']/ComputedMember]

# PowerShell Cmdlet to find all users in portal not having a manager            
# Load FIMAutomation module            
            
 if(@(Get-PSSnapin | ? { $_.Name -eq "FIMAutomation" } ).Count -eq 0)            
 {            
     Add-PSSnapin FIMAutomation;            
 }            
$users = Export-FIMConfig -customConfig "/Person[not(Manager=/Person)]" -Uri "http://localhost:5725"  -OnlyBaseResources            
foreach ($user in $users)            
{            
    $x = (($user.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "DisplayName"}).Value)
    Write-Host "$x"            
}