Skip to content

Instantly share code, notes, and snippets.

# Remember to run the script "as Administrator"
$AdminNote1 = Read-Host 'Are you running this script in Powershell as administrator? (Yes/No)'
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($env:USERPROFILE + '\AppData\Local\Microsoft\VisualStudio') > $null
$pathExclusions.Add($env:USERPROFILE + '\.nuget\packages') > $null
$pathExclusions.Add('C:\ProgramData\Microsoft\VisualStudio\Packages') > $null
@Fantasillion
Fantasillion / 1st time install.ps1
Created October 28, 2022 10:17
Install Microsoft Azure Office Online powershell modules
Install-Module ExchangeOnlineManagement
Install-Module -Name MicrosoftTeams
Install-Module AzureRM -AllowClobber
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Install-Module -Name AzureAD
@Fantasillion
Fantasillion / Office 365 Group hidden from Outlook because created in Teams.ps1
Last active November 9, 2023 13:23
Office 365 Group hidden from Outlook because created in Teams
#Install and connect:
Install-Module ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
Connect-ippssession -UserPrincipalName youremail@domain.com #replace youremail@domain.com with your own. Make sure you have access/permission/roles.
Connect-ExchangeOnline -UserPrincipalName youremail@domain.com #replace youremail@domain.com with your own. Make sure you have access/permission/roles.
#Find all:
Get-UnifiedGroup | Select DisplayName,@{Name="NameLength";Expression={$_.name.length}}, Alias, PrimarySmtpAddress, HiddenFromExchangeClientsEnabled
#Find specific:
@Fantasillion
Fantasillion / Replace Primary Mail Address on Group.ps1
Created October 28, 2022 10:27
Replace Primary Mail Address on Group
#Instructions for both O365 Groups and Distribution Lists
#For O365 Groups:
#1.a Find specific group name. Replace put group name here with the name of the group.
Get-UnifiedGroup -Identity "put group name here" | Select Name,@{Name="NameLength";Expression={$_.name.length}}, EmailAddresses, Alias, ServerName, AccessType
#1.b List all groups with names.
Get-UnifiedGroup | Select Name,@{Name="NameLength";Expression={$_.name.length}}, EmailAddresses, Alias, ServerName, AccessType
#2. Add mail address. Replace put group name here with the name of the group. Replace putmail address here with the new mail address.
@Fantasillion
Fantasillion / Office 365 Upgrade Distribution List to Group and remove Distribution List when done.ps1
Created October 28, 2022 10:29
Office 365 Upgrade Distribution List to Group and remove Distribution List when done
New-UnifiedGroup -DlIdentity "insert name of Distribution List here" –ConvertClosedDlToPrivateGroup:$true -DeleteDlAfterMigration
@Fantasillion
Fantasillion / Get Room Lists for Room Finder and Rooms .ps1
Created October 28, 2022 10:34
Get Room Lists for Room Finder and Rooms
#Get list of Room Lists for Room Finder in Outlook
Get-DistributionGroup -ResultSize Unlimited | Where {$_.RecipientTypeDetails -eq "RoomList"} | Format-Table DisplayName,Identity,PrimarySmtpAddress -AutoSize
#Get list of Rooms
Get-Mailbox -RecipientTypeDetails RoomMailbox
@Fantasillion
Fantasillion / Office 365 List membership groups for each user.ps1
Created October 28, 2022 10:36
Office 365 List membership groups for each user
(Get-DistributionGroup).identity | ForEach-Object{
$DistributionGroupName = $_
Get-DistributionGroupMember -Identity $_ | ForEach-Object{
[PSCustomObject]@{
DistributionGroup = $DistributionGroupName
MemberName = $_.Name
#Other recipient properties here
}
}
}
@Fantasillion
Fantasillion / Office 365 Exchange Online get mailbox when created date.ps1
Last active October 28, 2022 11:12
Office 365 Exchange Online get mailbox when created date
get-mailbox -id <replace brackets and contents with mail address> | select whenCreated
@Fantasillion
Fantasillion / Office 365 Exchange Online Get all mail aliases for Group or Distribution List.ps1
Last active October 28, 2022 11:12
Office 365 Exchange Online Get all mail aliases for Group or Distribution List
#Get all mail aliases for group:
#Distribution Group:
Get-distributiongroup <replace brackets and contents with Group name> | select -ExpandProperty EmailAddresses
#O365 Group:
Get-UnifiedGroup <replace brackets and contents with Group name> | select -ExpandProperty EmailAddresses
@Fantasillion
Fantasillion / Check for HiddenFromExchangeClientsEnabled.ps1
Created October 28, 2022 10:55
Office 365 Exchange Online Check for HiddenFromExchangeClientsEnabled
$Groups = Get-UnifiedGroup -ResultSize Unlimited | Select DisplayName, Alias, PrimarySmtpAddress, HiddenFromExchangeClientsEnabled
Write-Host "Processing" $Groups.Count "groups"
$Report = @()
$TeamsGroups = 0
$NoConvHistory = 0
ForEach ($G in $Groups) {
Write-Host "Processing" $G.DisplayName
If ($G.HiddenFromExchangeClientsEnabled -eq $true) { # Used to be HiddenFromExchangeClients
$ChatCheck = $Null
$ChatCheck = (Get-MailboxFolderStatistics -Identity $G.Alias -FolderScope ConversationHistory -IncludeOldestAndNewestItems)