Wednesday, March 23, 2016

Get companies list with their TenantID/Domain/Custom Domains/Company Name using CSP DAP

Use PowerShell script to get mapping between Company Name, TenantID, TenantDomain name "*" and CustomDomains.
You need to be connected with Office 365 using Partner account that has delegated access permission (DAP) to Cloud Solution Provider (CSP) Tenants prior to PowerShell script execution.

Get-MsolPartnerContract -All | select @{n="TenantID";e={$_.TenantID.tostring()}} | `
Get-MsolCompanyInformation  -ErrorAction SilentlyContinue | `
select ObjectId, InitialDomain, DisplayName, TechnicalNotificationEmails, `
@{Label="CustomDomains";e={Get-MsolDomain -TenantId $_.ObjectId -ErrorAction SilentlyContinue | ? IsInitial -ne $true | select -expandproperty name}}

No comments:

Post a Comment