As a partner managing lot’s of tenants in Office 365, it could prove useful to have a full list of these tenants and their subscriptions.
As always, you first need to connect to your own Office 365 tenant in PowerShell. A great tutorial can be found here.
Snippet
Connected? Splendid.
This snippet runs a query with the Get-MsolPartnerContract cmdlet. It returns all contracts, delegated to you as a partner. The function then lists all subscriptions, amount of licenses and the status of these licenses.
function Get-TenantSubscriptions {Get-MsolPartnerContract | foreach {$tenant_id = $_.tenantid.guid$tenant_name = $_.nameGet-MsolSubscription -TenantId $tenant_id | select @{Expression={$tenant_name};Label="Tenant name"}, skupartnumber, status, nextlifecycledate, totallicenses}}
Of course be careful with these kind of commands. Actions performed in bulk, on all of your customers, could have great consequences.
Cheers.