test.ps1
$Tenants = Get-Tenants $Completed = 0 Write-Progress -Activity "Processing 0/$($Tenants.Count)" -Status "0% completed" -PercentComplete 0 $Tenants | ForEach-Object { $Percent = [Math]::Floor($Completed / $Tenants.Count * 100) $Tenant = $_ Write-Progress -Activity "Processing $($Completed)/$($Tenants.Count)" -Status "$($Percent)% completed" -PercentComplete $Percent $GDAPRelationship = Get-MgTenantRelationshipDelegatedAdminCustomer -DelegatedAdminCustomerId $Tenant.CustomerId -Erroraction SilentlyContinue #$GDAPRelationship | fl #Get-MgTenantRelationship if($GDAPRelationship -eq $null) { Write-Host "Tenant $($Tenant.DefaultDomainName) - No GDAP relationship found" -ForegroundColor Yellow } $Completed += 1 } Write-Progress -Activity "Processing $($Completed)/$($Tenants.Count)" -Status "100% completed" -PercentComplete 100 |