<< A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

–A–

–B–

–C–

–D–

delete orphaned synced user attempt, but system won't allow you to delete - see synced user in AAD has no corresponding user in AD and won't let you delete

deleted user (soft deleted), delete permanantly - see user, soft deleted - delete permanantly - useful in a situation where you're trying to delete a user but the system claims some other, similarly named user is already clogging up the deleted users

deleted users (soft deleted), list - see also deleted mailboxes, list

Get-MsolUser -All -ReturnDeletedUsers | Sort-Object UserPrincipalName | ft UserPrincipalName, DisplayName, ObjectId

deleted user (soft deleted), restore when UserPrincipalName has a domain not accepted by the tenant - see user, restore when UserPrincipalName has a domain not accepted by the tenant

domain, find users who belong to a particular domain

Get-MsolUser | where {($_.userprincipalname -match "yourdomain.com")}

domain, find all users - sort by domain

Get-MsolUser | Select-Object @{n="Dom";e={$_.UserPrincipalName.split("@")[1]}}, displayName, userprincipalname | Sort-Object dom, displayName

domain, force removal from tenant

Remove-MsolDomain -DomainName "yourdomain.com" -Force

–E–

email user info

get-msoluser -userprincipalname test@yourdomain.com | fl

–F–

–G–

ghost users, track down (duplicates, etc.)

Sometimes the system claims there's interference with users you just can't seem to find anywhere. This is a list of commands to try to find locations of these interferences.

$m="someuser@yourTenant.onmicrosoft.com"

Get-MsolUser -All | where-Object {$_.ProxyAddresses -match "$m"} | fl

Get-MsolUser -All | Where-Object {$_.UserPrincipalName -match "$m"} | fl

Get-MsolContact -All | Where {$_.EmailAddress -match "$m"} | FL

Get-MsolGroup -All | Where-Object {$_.ProxyAddresses -match "$m"} | fl

Get-MsolUser -ReturnDeletedUsers -All | Where-Object {$_.ProxyAddresses -match "$m"} | fl

#Get-Recipient -ResultSize unlimited | Where {$_.EmailAddresses -match "$m"} | FL Name, RecipientType, emailAddresses

Get-Recipient -ResultSize unlimited | Where {$_.EmailAddresses -match "$m"} | FL

Get-Mailbox -SoftDeletedMailbox | Where {$_.EmailAddresses -match "$m"} | FL

Get-Recipient -Filter: "name -like '*cnf*'" | fl

Get-Mailbox -PublicFolder | FL EmailAddresses

GUID for a user

Get-Mailbox -identity someuser | select DisplayName, GUID, ExchangeGUID

–H–

–I–

immutable ID, sync local user to cloud user - see sync local user to cloud user

–J–

–K–

–L–

licenses currently available on this tenant

Get-MsolAccountSku

which returns the same thing as those licenes ostensibly used

Get-MsolAccountSku | Where {$_.ConsumedUnits -ge 1}

licenses for a user

Get-MsolUser -UserPrincipalName user@yourdomain.com | Select-Object -ExpandProperty Licenses | Select-Object -ExpandProperty ServiceStatus

licenses, who all has a particular

In this case, Office Premium

Get-MSOLUser -All | where {$_.isLicensed -eq "TRUE" -and $_.Licenses.AccountSKUID -eq "yourtenant:O365_BUSINESS_PREMIUM"} | select displayname,userprincipalname,isLicensed

licenses, who all has what on this tenant?

$Sku = @{
    "EMS" = "Enterprise Mobility Suite"
    "EXCHANGEDESKLESS" = "Exch Kisok" #"Exchange Online Kiosk"
    "EXCHANGESTANDARD" = "O356 Exch Only" #"Office 365 Exchange Online Only"
    "O365_BUSINESS_PREMIUM" = "O365 Prem" #"Office Business Premium"
    "OFFICESUBSCRIPTION" = "O365 Pro+" # "Office 365 ProPlus"
    "POWER_BI_STANDARD" = "Power-BI standard"
    "SHAREPOINTENTERPRISE" = "SP Pl2" #"SharePoint Online (Plan 2)"
    "SHAREPOINTSTANDARD_YAMMER" = "SP Pl1 Ymr" # "SharePoint Online (Plan 1) with Yammer"
    "VISIOCLIENT" = "Visio" #"Visio Pro Online"
}
$logfile = "Office_365_License" + [DateTime]::Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".csv"
$mytemp = [environment]::getfolderpath("mydocuments")
$logfile = $mytemp + "\" + $logfile  # your local "My Documents"
$licenseType = Get-MsolAccountSku | Where {$_.ConsumedUnits -ge 1} # list  all licenses in the tenant
$headerString = "Display Name, Domain, UPN" # Build the Header for the CSV file
$numLicenses = 0
write-host "Geting the licenses and writing the header..."
foreach ($license in $licenseType) # Loop through all license types found in the tenant to add licenseTypes
{
    $headerString = $headerString + "," + $Sku.Item($license.SkuPartNumber)
    $numLicenses++
}
$headerString = $headerString + ",Errors, ImmutableId, BlockCredential" # Add other attributres
Out-File -FilePath $LogFile -InputObject $headerString -Encoding UTF8 -append
write-host "Getting all users in the Office 365 tenant..." # Get a list of all the users in the tenant
$users = Get-MsolUser -all | where { $_.isLicensed -eq "True"}
foreach ($user in $users) # Loop through all users found in the tenant
{
    $lineString = $user.displayname -Replace ",","" # use last name, comma first name as display name so remove the comma
    write-host ("Processing " + $lineString)
    $lineString = $lineString + "," + $user.UserPrincipalName.Split("@")[1]  + "," + $user.userprincipalname  #+ "," + $user.isLicensed
        for($j=0;$j -lt $numLicenses; ++$j) # Loop through all license types found in the tenant
        {
            $userhaslicense = ""
            foreach ($row in $user.licenses) # Loop through all licenses assigned to this user
            {
                if ($row.AccountSkuId.ToString() -eq $licenseType.AccountSkuId[$j])
                {
                    $userhaslicense = "x"
                }
            }
            $lineString = $lineString + "," + $userhaslicense
        }
    $lineString = $lineString + "," + $user.Errors + "," + $user.ImmutableId + "," + $user.BlockCredential
    Out-File -FilePath $LogFile -InputObject $lineString -Encoding UTF8 -append
}
write-host ("Script Completed. Results available in " + $LogFile)

–M–

–N–

–O–

orphaned synced user, can't delete - see synced user in AAD has no corresponding user in AD and won't let you delete

–P–

–Q–

–R–

recycle bin, remove user from

Remove-MsolUser -UserPrincipalName user@yourdomain.com -RemoveFromRecycleBin

recycle bin, restore user from the domain is no longer accepted by the tenant

Restore-MsolUser -UserPrincipalName someuser@baddomain.com -AutoReconcileProxyConflicts -NewUserPrincipalName someuser@yourTenant.onmicrosoft.com

–S–

soft deleted user, delete permanantly - see user, soft deleted - delete permanantly - useful in a situation where you're trying to delete a user but the system claims some other, similarly named user is already clogging up the deleted users

sync local user to cloud user

$guid = (get-Aduser someuser).ObjectGuid
$immutableID = [System.Convert]::ToBase64String($guid.tobytearray())
Set-MSOLuser -UserPrincipalName someuser@yourdomain.com -ImmutableID $immutableID

sync problems

Get-MsolDirSyncProvisioningError -ErrorCategory PropertyConflict -PropertyName UserPrincipalName
Get-MsolDirSyncProvisioningError -ErrorCategory PropertyConflict -PropertyName ProxyAddresses
Get-MsolUser -UserPrincipalName user@yourdomain.com | fl DirSyncProvisioningErrors

synced user in AAD has no corresponding user in AD and won't let you delete

Remove-MsolUser -UserPrincipalName someUser@yourTenant.onmicrosoft.com -force

–T–

tenant, which one am I on?

Get-MsolAccountSku

term 'xx' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (Exchange)

for example:

get-mailbox -ResultSize Unlimited

returns:

get-mailbox : The term 'get-mailbox' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ get-mailbox -ResultSize Unlimited
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (get-mailbox:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

need to run:

add-pssnapin *exchange* -erroraction SilentlyContinue

–U–

unlicensed users

Get-MsolUser -All -UnlicensedUsersOnly

unlicensed users, suppress entries from showing up in the Offline Address Book (OAB) or Global Address List (GAL) - see Global Address List (GAL), suppress entries

user, does he exist?

$User = Get-MsolUser -UserPrincipalName $target -ErrorAction SilentlyContinue -ErrorVariable errorVariable
If ($User -ne $Null)
{
    write-host "$target exists" -Foregroundcolor green 
} Else
{
    write-host "$target does not exist" -Foregroundcolor yellow
}

user info

Get-MsolUser -UserPrincipalName someUser@yourDomain.com | fl

users, list all sorted by domain - see domain, find all users - sort by domain

user, soft deleted - delete permanantly

Sometimes you run into a situation where you're trying to delete a user but the system claims some other, similarly named user is already clogging up the deleted users

Get-MsolUser -ReturnDeletedUsers -SearchString someuser@yourdomain.com | FL UserPrincipalName, ObjectID

Sometimes, can't return a soft deleted user by name even though you see him right there. In that case, run:

Get-MsolUser -All -ReturnDeletedUsers | ft DisplayName, ObjectId

and grab the appropriate ObjectID so you can delete it that way. Whichever way you get it, once you have it, use the ObjectId to delete:

Remove-MsolUser -ObjectId 8b0b9ca0-a3cf-4444-9b1b-c8dc92e69261 -RemoveFromRecycleBin -Force

Now, finally, you can delete the object you orginally intended

Remove-MsolUser -UserPrincipalName someuser@yourdomain.com -RemoveFromRecycleBin

user soft deleted, restore when UserPrincipalName has a domain not accepted by the tenant

Restore-MsolUser -UserPrincipalName someuser@baddomain.com -AutoReconcileProxyConflicts -NewUserPrincipalName someuser@yourTenant.onmicrosoft.com

user info (email) - Office 365

individual - use either UPN:

Get-MsolUser -userprincipalname test@yourdomain.com | fl

or objectID:

Get-MsolUser -ObjectId 81701046-cb37-439b-90ce-2afd9630af7d | fl

everyone:

Get-MsolUser | Sort-Object DisplayName,UserPrincipalName

userPrincipalName

change:

Set-MsolUserPrincipalName -UserPrincipalName "becky.smith@yourcompany.onmicrosoft.com" -NewUserPrincipalName"becky.smith@yourcompany.com"

–V–

–W–

Where am I? As in: which tenant am I on?

Get-MsolAccountSku

Which tenant am I on? - the closest I can find is the command to list all the licenses that a tenant has available: Get-MsolAccountSku. This will return a list of license SKUs. Embedded in each AccountSkuId will be the tenant name before the ":". Pretty hokey.

–X–

–Y–

–Z–