You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some assumptions are made with the following statement which are not always true - eg. user email may be [email protected] however the onmicrosoft domain may be different, say companyxy.onmicrosoft.com and the SPO domain is based on this
[string] $TenantDomain = (ConvertTo-Domain $UserPrincipalName)
The following would get the correct name:
$domains = get-msoldomain ## get a list of all domains in tenant
foreach ($domain in $domains) { ## loop through all these domains
if ($domain.name.contains('onmicrosoft')) { ## find the onmicrosoft.com domain
$onname = $domain.name.split(".") ## split the onmicrosoft.com domain when found at the period. Will produce an array that contains each string as an element
$tenantname = $onname[0] ## the first string in this array is the name of the tenant
} ## end of find the on.microsoft.com domain
}
The text was updated successfully, but these errors were encountered:
Regarding: https://github.com/nickrod518/PowerShell-Scripts/blob/master/MSO/OneDrive.psm1
Some assumptions are made with the following statement which are not always true - eg. user email may be [email protected] however the onmicrosoft domain may be different, say companyxy.onmicrosoft.com and the SPO domain is based on this
[string] $TenantDomain = (ConvertTo-Domain $UserPrincipalName)
The following would get the correct name:
The text was updated successfully, but these errors were encountered: