-
Notifications
You must be signed in to change notification settings - Fork 0
/
Syndication Check - All delegated admin tenants.ps1
45 lines (35 loc) · 1.26 KB
/
Syndication Check - All delegated admin tenants.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# --------------------------------------------------------------
#
# TelstraCheck.ps1
#
# --------------------------------------------------------------
#
# Using delegated administrator credentials, checks each
# tenant and determines if syndicated with Telstra. Results
# are displayed in a gridview for easy filtering and sorting.
#
# Note - applies to Australia only. Syndication in other
# countries may mean something different.
#
# --------------------------------------------------------------
function MSOLConnected {
Get-MsolDomain -ErrorAction SilentlyContinue | out-null
$result = $?
return $result
}
$tenantArray = @()
$cred = Get-Credential
Connect-MsolService -Credential $cred
# if connection fails, exit.
if(-not (MSOLConnected)) {
exit
}
# Get list of tenants & loop
Get-MsolPartnerContract -All | ForEach {
$tenantDetails = @{}
$tenantDetails.Tenant = [string]$_.DefaultDomainName
$tenantDetails.Syndicated = "No"
Get-MsolAccountSku -TenantId $_.TenantId.Guid | Foreach { if($_.AccountName -eq "syndication-account") { $tenantDetails.Syndicated = "Yes" } }
$tenantArray += New-Object -TypeName PSObject -Prop $tenantDetails
}
$tenantArray | Sort-Object -Property Syndicated -Descending | Out-GridView