Skip to content

Instantly share code, notes, and snippets.

@mirontoli
Created January 17, 2020 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirontoli/597be94edb48f85b5de7f60a410756f3 to your computer and use it in GitHub Desktop.
Save mirontoli/597be94edb48f85b5de7f60a410756f3 to your computer and use it in GitHub Desktop.
Install-Module MSOnline -Scope CurrentUser
Connect-MsolService
Get-MsolUser
Get-MsolUser -All | Where-Object { $_.isLicensed -eq $true}
Get-MsolUser -All -UnlicensedUsersOnly
$user = Get-MsolUser | Where-Object { $_.UserPrincipalName.StartsWith("EmilyB") }
$status = $user.Licenses[0].ServiceStatus
$status | Where-Object { $_.ServicePlan.ServiceName -eq "TEAMS1" }
$licensedUsers = Get-MsolUser -All | Where-Object {$_.isLicensed -eq $true }
$usersWithoutTeams = $licensedUsers `
| ForEach-Object { `
$user = $_;`
$status=$user.Licenses[0].ServiceStatus;`
$teamsDisabled = $status | Where-Object { $_.ServicePlan.ServiceName -eq "TEAMS1" -and $_.ProvisioningStatus -eq "Disabled"};`
if($teamsDisabled) {$user}`
}
Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser -Confirm:$false
#set-executionpolicy Unrestricted
Connect-SPOService
Get-SPOSite
Get-SPOWebTemplate
Get-SPOSite | Select-Object Url, Title, Template
Get-SPOSite | Select-Object Url, Title, Template | Where-Object { $_.Template -eq "GROUP#0" }
$siteurl = "https://<tenant>.sharepoint.com"
Get-SPOSiteGroup -Site $siteUrl | Format-Table
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $(Get-Credential) -Authentication Basic -AllowRedirection
Import-PSSession $session
Get-Mailbox
Get-Mailbox -RecipientTypeDetails UserMailbox
Get-MailboxStatistics -Identity admin@<tenant>.onmicrosoft.com | Format-List
Get-Mailbox | Get-MailboxStatistics | Select-Object DisplayName, ItemCount, TotalItemSize | Export-Csv -Path MailboxStats.csv -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment