Connect to all the Microsoft 365 Services

Connect to all the Microsoft 365 Services
This commit is contained in:
AdminDroid 2023-10-06 17:23:22 +05:30
parent 08a0301e4c
commit bddeec0a0c
23 changed files with 700 additions and 263 deletions

View File

@ -1,10 +1,26 @@
 <#
=============================================================================================
Name: Connect to all the Office 365 services using PowerShell
Description: This script automatically installs all the required modules(upon your confirmation) and connects to the services
Version: 3.5
Website: o365reports.com
1.Installs Office 365 PowerShell modules. ie, Modules required for Office 365 services are automatically downloaded and installed upon your confirmation.
2.You can connect to one or more Office 365 services via PowerShell using a single cmdlet.
3.You can connect to Office 365 services with MFA enabled account.
4.For non-MFA account, you dont need to enter credential for each service. Youll be asked to enter your credential only once!
5.The script is scheduler friendly. i.e., credentials can be passed as a parameter instead of saving inside the script.
6.You can disconnect all service connections using a single cmdlet.
For detailed script execution: https://o365reports.com/2019/10/05/connect-all-office-365-services-powershell/
============================================================================================
#>
Param Param
( (
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[switch]$Disconnect, [switch]$Disconnect,
[ValidateSet('AzureAD','MSOnline','ExchangeOnline','SharePoint','SharePointPnP','SecAndCompCenter','Skype','Teams')] [ValidateSet('MSOnline','AzureAD','ExchangeOnline','SharePoint','SharePointPnP','SecAndCompCenter','Teams')]
[string[]]$Services=("AzureAD","MSOnline","ExchangeOnline",'SharePoint','SharePointPnP','SecAndCompCenter','Skype','Teams'), [string[]]$Services=("MSOnline","AzureAD","ExchangeOnline",'SharePoint','SharePointPnP','SecAndCompCenter','Teams'),
[string]$SharePointHostName, [string]$SharePointHostName,
[Switch]$MFA, [Switch]$MFA,
[string]$UserName, [string]$UserName,
@ -37,7 +53,7 @@ else
$Credential=Get-Credential -Credential $null $Credential=Get-Credential -Credential $null
} }
$ConnectedServices="" $ConnectedServices=""
if($Services.Length -eq 8) if($Services.Length -eq 7)
{ {
$RequiredServices=$Services $RequiredServices=$Services
} }
@ -211,7 +227,7 @@ else
{ {
$ConnectedServices=$ConnectedServices+"," $ConnectedServices=$ConnectedServices+","
} }
$ConnectedServices=$ConnectedServices+"SharePoint Online" $ConnectedServices=$ConnectedServices+" SharePoint Online"
} }
} }
@ -255,47 +271,7 @@ else
{ {
$ConnectedServices=$ConnectedServices+"," $ConnectedServices=$ConnectedServices+","
} }
$ConnectedServices=$ConnectedServices+"SharePoint PnP" $ConnectedServices=$ConnectedServices+" SharePoint PnP"
}
}
#Module and Connection settings for Skype for Business Online module
Skype
{
$Module=Get-InstalledModule -Name MicrosoftTeams -MinimumVersion 1.1.6
if($Module.count -eq 0)
{
Write-Host Required MicrosoftTeams module is not available -ForegroundColor yellow
$Confirm= Read-Host Are you sure you want to install module? [Y] Yes [N] No
if($Confirm -match "[yY]")
{
Install-Module MicrosoftTeams -AllowClobber
}
else
{
Write-Host MicrosoftTeams module is required.Please install module using Install-Module MicrosoftTeams cmdlet.
}
Continue
}
if($MFA.IsPresent)
{
$sfbSession = New-CsOnlineSession
Import-PSSession $sfbSession -AllowClobber | Out-Null
}
else
{
$sfbSession = New-CsOnlineSession -Credential $Credential
Import-PSSession $sfbSession -AllowClobber -WarningAction SilentlyContinue | Out-Null
}
#Check for Skype connectivity
If ((Get-PSSession | Where-Object { $_.ConfigurationName -like "Microsoft.PowerShell" }) -ne $null)
{
if($ConnectedServices -ne "")
{
$ConnectedServices=$ConnectedServices+","
}
$ConnectedServices=$ConnectedServices+"Skype"
} }
} }
@ -338,16 +314,16 @@ else
} }
#Module and Connection settings for Teams Online module #Module and Connection settings for Teams Online module
Teams Teams
{ {
$Module=Get-InstalledModule -Name MicrosoftTeams -MinimumVersion 1.1.6 $Module=Get-InstalledModule -Name MicrosoftTeams -MinimumVersion 4.0.0
if($Module.count -eq 0) if($Module.count -eq 0)
{ {
Write-Host Required MicrosoftTeams module is not available -ForegroundColor yellow Write-Host Required MicrosoftTeams module is not available -ForegroundColor yellow
$Confirm= Read-Host Are you sure you want to install module? [Y] Yes [N] No $Confirm= Read-Host Are you sure you want to install module? [Y] Yes [N] No
if($Confirm -match "[yY]") if($Confirm -match "[yY]")
{ {
Install-Module MicrosoftTeams -AllowClobber Install-Module MicrosoftTeams -AllowClobber -Force
} }
else else
{ {
@ -370,7 +346,7 @@ else
{ {
$ConnectedServices=$ConnectedServices+"," $ConnectedServices=$ConnectedServices+","
} }
$ConnectedServices=$ConnectedServices+"Teams" $ConnectedServices=$ConnectedServices+" Teams"
} }
} }
} }
@ -379,5 +355,7 @@ else
{ {
$ConnectedServices="-" $ConnectedServices="-"
} }
Write-Host `n`nConnected Services $ConnectedServices -ForegroundColor DarkYellow Write-Host `n`nConnected Services - $ConnectedServices -ForegroundColor DarkYellow
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }

View File

@ -2,8 +2,16 @@
============================================================================================= =============================================================================================
Name: Export Office 365 nested distribution group members report Name: Export Office 365 nested distribution group members report
Description: This script exports Office 365 nested distribution list members to CSV file Description: This script exports Office 365 nested distribution list members to CSV file
website: m365scripts.com Website: m365scripts.com
Script by: m365scripts Team
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script uses modern authentication to connect to Exchange Online.
2.The script can be executed with MFA enabled account.
3.Primarily, the script exports nested distribution group members in two well-formatted CSV files One with detailed information and another with summary information.
4.Automatically installs the EXO V2 module (if not installed already) upon your confirmation.
5.The script is scheduler-friendly, so worry not! i.e., credentials can be passed as parameters rather than being saved inside the script.
For detailed Script execution: https://m365scripts.com/exchange-online/export-office-365-nested-distribution-group-members-using-powershell/ For detailed Script execution: https://m365scripts.com/exchange-online/export-office-365-nested-distribution-group-members-using-powershell/
============================================================================================ ============================================================================================
#> #>
@ -52,7 +60,7 @@ else
#Get nested distribution group member #Get nested distribution group member
Write-Host "Getting nested distribution groups and its members ...." Write-Host "Getting nested distribution groups and its members ...."`n
$OutputCsv2=".\NestedDistributionGroupMembersSummaryList_$((Get-Date -format MMM-dd` hh-mm` tt).ToString()).csv" $OutputCsv2=".\NestedDistributionGroupMembersSummaryList_$((Get-Date -format MMM-dd` hh-mm` tt).ToString()).csv"
$OutputCsv1=".\NestedDistributionGroupMembersDetailInfo_$((Get-Date -format MMM-dd` hh-mm` tt).ToString()).csv" $OutputCsv1=".\NestedDistributionGroupMembersDetailInfo_$((Get-Date -format MMM-dd` hh-mm` tt).ToString()).csv"
$DistributionGroupCount = 0 $DistributionGroupCount = 0
@ -176,26 +184,28 @@ Get-DistributionGroup -ResultSize unlimited | ForEach-Object {
#Open output file after execution #Open output file after execution
if($DistributionGroupCount -eq 0) if($DistributionGroupCount -eq 0)
{ {
Write-Host "No distribution group found in this organization" Write-Host "No distribution group found in this organization"`n
} }
else else
{ {
Write-Host "$DistributionGroupCount Distribution group found in this organization" Write-Host "$DistributionGroupCount Distribution group found in this organization"`n
if($Global:GroupWithNestedGroupCount -ne 0) if($Global:GroupWithNestedGroupCount -ne 0)
{ {
Write-Host "$Global:GroupWithNestedGroupCount Distribution group found with nested group" Write-Host "$Global:GroupWithNestedGroupCount Distribution group found with nested group"`n
if((Test-Path -Path $OutputCsv1) -eq "True" -and (Test-Path -Path $OutputCsv2) -eq "True") if((Test-Path -Path $OutputCsv1) -eq "True" -and (Test-Path -Path $OutputCsv2) -eq "True")
{ {
Write-Host "The output files are available in the current working directory" Write-Host "The output files are available in the current working directory"
Write-Host "The Summary report name : $OutputCsv2" -ForegroundColor Green Write-Host `n "The Summary report name :" -NoNewline -ForegroundColor Yellow; Write-Host "$OutputCsv2"
Write-Host "The Detailed report name : $OutputCsv1" -ForegroundColor Green Write-Host `n "The Detailed report name :" -NoNewline -ForegroundColor Yellow; Write-Host "$OutputCsv1"
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output files?",` 0,"Open Output Files",4) $UserInput = $Prompt.popup("Do you want to open output files?",` 0,"Open Output Files",4)
if ($UserInput -eq 6) if ($UserInput -eq 6)
{ {
Invoke-Item "$OutputCSV1" Invoke-Item "$OutputCSV1"
Invoke-Item "$OutputCSV2" Invoke-Item "$OutputCSV2"
} }
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
} }
else else

View File

@ -4,6 +4,16 @@ Name: Get storage used by Office 365 groups
Description: This script find Office 365 groups' size and exports the report to CSV file Description: This script find Office 365 groups' size and exports the report to CSV file
Version: 1.0 Version: 1.0
Website: o365reports.com Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1. The script uses modern authentication to connect to Exchange Online.
2. The script can be executed withMFA enabled account too.
3. Automatically install the EXO V2 and SharePoint PnP PowerShell module (if not installed already) upon your confirmation.
4. Credentials are passed as parameters (Scheduler-friendly), so worry not! i.e., credentials can be passed as parameters rather than being saved inside the script.
5. Exports the report result toa CSV file.
6. Lists the details of the storage used in each Office 365 group.
For detailed script execution: https://o365reports.com/2022/05/18/get-the-storage-used-by-office-365-groups-using-powershell/ For detailed script execution: https://o365reports.com/2022/05/18/get-the-storage-used-by-office-365-groups-using-powershell/
============================================================================================ ============================================================================================
#> #>
@ -94,7 +104,7 @@ else
#Get storage used by office 365 groups... #Get storage used by office 365 groups...
Write-Host "Getting office 365 groups storage..." Write-Host "Getting office 365 groups storage..."`n
$OutputCsv=".\Office365GroupsStorageSizeReport_$((Get-Date -format MMM-dd` hh-mm` tt).ToString()).csv" $OutputCsv=".\Office365GroupsStorageSizeReport_$((Get-Date -format MMM-dd` hh-mm` tt).ToString()).csv"
#Getting all sites which have an underlying Microsoft 365 group #Getting all sites which have an underlying Microsoft 365 group
$GroupSites = Get-PnPTenantSite -GroupIdDefined $true | Select-Object StorageUsageCurrent, StorageQuota, Url $GroupSites = Get-PnPTenantSite -GroupIdDefined $true | Select-Object StorageUsageCurrent, StorageQuota, Url
@ -122,7 +132,7 @@ Get-UnifiedGroup -ResultSize unlimited | ForEach-Object {
#Groupcount details #Groupcount details
if($GroupCount -ne 0) if($GroupCount -ne 0)
{ {
Write-Host "$GroupCount Office 365 groups found in this organization" Write-Host "$GroupCount Office 365 groups found in this organization."`n
} }
else else
{ {
@ -133,7 +143,10 @@ else
#Open output file after execution #Open output file after execution
if((Test-Path -Path $OutputCsv) -eq "True") if((Test-Path -Path $OutputCsv) -eq "True")
{ {
Write-Host "The office 365 groups storage report available in : $OutputCsv" -ForegroundColor Green Write-Host " The office 365 groups storage report available in:" -NoNewline -ForegroundColor Yellow; Write-Host $OutputCsv
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline;
Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` 0,"Open Output File",4) $UserInput = $Prompt.popup("Do you want to open output file?",` 0,"Open Output File",4)
If ($UserInput -eq 6) If ($UserInput -eq 6)

View File

@ -1,4 +1,24 @@
Param <#
=============================================================================================
Name: Get License Expiry Date report
Version: 2.0
Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~~
1.Exports Office 365 license expiry date with next lifecycle activity date.
2.Exports report to the CSV file.
3.Result can be filtered based on subscription type like Purchased, Trial and Free subscription
4.Result can be filtered based on subscription status like Enabled, Expired, Disabled, etc.
5.Subscription name is shown asuser-friendly-namelike Office 365 Enterprise E3 rather than ENTERPRISEPACK.
6.The script can be executed with MFA enabled account too.
7.The script is scheduler friendly. i.e., credentials can be passed as a parameter instead of saving inside the script.
For detailed script execution: https://o365reports.com/2020/03/04/export-office-365-license-expiry-date-report-powershell/
============================================================================================
#>
Param
( (
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[switch]$Trial, [switch]$Trial,
@ -181,8 +201,14 @@ $Subscriptions= Get-MsolSubscription | foreach{
#Open output file after execution #Open output file after execution
if((Test-Path -Path $ExportCSV) -eq "True") if((Test-Path -Path $ExportCSV) -eq "True")
{ {
Write-Host `nOffice 365 license expiry report available in: $ExportCSV -ForegroundColor Green Write-Host ""
Write-Host `nThe Output file contains $PrintedOutput subscriptions Write-Host " Office 365 license expiry report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportCSV
Write-Host ""
Write-Host " The Output file contains:" -NoNewline -ForegroundColor Yellow
Write-Host $PrintedOutput subscriptions
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output files?",` $UserInput = $Prompt.popup("Do you want to open output files?",`
0,"Open Files",4) 0,"Open Files",4)

View File

@ -4,6 +4,16 @@ Name: List all Exchange Online mailboxes users can access
Version: 1.0 Version: 1.0
Website: m365scripts.com Website: m365scripts.com
Script by: M365Scripts Team Script by: M365Scripts Team
Script Highlights:
~~~~~~~~~~~~~~~~~
1.Exports mailbox rights for all users by default.
2.Allows to generate mailbox rights report for a list of users through input CSV.
3.List mailboxes the users have Send As/Send On Behalf/Full Access permissions.
4.The script can also be executed with MFA enabled account also.
5.Export report results to CSV file.
6.The script is scheduler-friendly. i.e., credentials are passed as parameters, so worry not!
For detailed script execution: https://m365scripts.com/exchange-online/URL Sluglist-exchange-online-mailboxes-user-has-access-using-powershell For detailed script execution: https://m365scripts.com/exchange-online/URL Sluglist-exchange-online-mailboxes-user-has-access-using-powershell
============================================================================================ ============================================================================================
#> #>
@ -150,7 +160,7 @@ else {
} }
} }
if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") { if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") {
Write-Host "The Output file availble in `"$global:ExportCSVFileName`"" -ForegroundColor Green Write-Host `n "The Output file availble in: " -NoNewline -ForegroundColor Yellow; Write-Host "`"$global:ExportCSVFileName`""`n
$prompt = New-Object -ComObject wscript.shell $prompt = New-Object -ComObject wscript.shell
$userInput = $prompt.popup("Do you want to open output files?", 0, "Open Output File", 4) $userInput = $prompt.popup("Do you want to open output files?", 0, "Open Output File", 4)
if ($userInput -eq 6) { if ($userInput -eq 6) {
@ -158,4 +168,6 @@ if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") {
} }
} }
Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue
Write-Host "Disconnected active ExchangeOnline session" Write-Host "Disconnected active ExchangeOnline session"
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n

View File

@ -1,13 +1,28 @@
<# <#
============================================================================================= =============================================================================================
Name: Office 365 Spam and Malware report Name: Export Office 365 Spam, Malware and phish Report using PowerShell
Description: This script exports Exchange Online spam and malware emails to CSV Description: This script exports Office 365 spam, malware and phish report to CSV
Version: 1.0 Version: 2.0
Website: o365reports.com Website: o365reports.com
Script by: O365Reports Team
For detailed script execution: https://o365reports.com/2021/05/18/export-office-365-spam-and-malware-report-using-powershell/ Script Highlights:
~~~~~~~~~~~~~~~~~
1.Generates 9 different email protection reports.
2.Automatically installs the Exchange Online PowerShell module upon your confirmation when it is not available in the system.
3.Supports both MFA and Non-MFA accounts.
4.Specify date ranges to generate reports for custom periods.
5.Supports filters to retrieve sent and received spams.
6.Allows you to filter sent and received malwares.
7.Tracks sent and received phishing emails.
8.Facilitates the separation of internal spam, malware, and phishing emails.
9.Exports the report to CSV.
10.Scheduler-friendly. You can automate the report generation upon passing credentials as parameters.
For detailed script execution: https://o365reports.com/2021/05/18/export-office-365-spam-and-malware-report-using-powershell
============================================================================================ ============================================================================================
#> #>
param( param(
[string] $UserName = $null, [string] $UserName = $null,
[string] $Password = $null, [string] $Password = $null,
@ -15,12 +30,17 @@ param(
[Switch] $SpamEmailsReceived, [Switch] $SpamEmailsReceived,
[Switch] $MalwareEmailsSent, [Switch] $MalwareEmailsSent,
[Switch] $MalwareEmailsReceived, [Switch] $MalwareEmailsReceived,
[Switch] $PhishEmailsSent,
[Switch] $PhishEmailsReceived,
[Switch] $IntraorgSpamMails,
[Switch] $IntraorgMalwareMails,
[Switch] $IntraorgPhishMails,
[Nullable[DateTime]]$StartDate, [Nullable[DateTime]]$StartDate,
[Nullable[DateTime]]$EndDate [Nullable[DateTime]]$EndDate
) )
Function DateAndSwitchesValidation { Function DateAndSwitchesValidation {
$global:MaxStartDate = ((Get-Date).Date).AddDays(-10) $global:MaxStartDate = ((Get-Date).Date).AddDays(-30)
if (($StartDate -eq $Null) -and ($EndDate -eq $Null)) { if (($StartDate -eq $Null) -and ($EndDate -eq $Null)) {
$StartDate = $global:MaxStartDate $StartDate = $global:MaxStartDate
$EndDate = (Get-date).Date $EndDate = (Get-date).Date
@ -37,13 +57,13 @@ Function DateAndSwitchesValidation {
$StartDate = [DateTime]$StartDate $StartDate = [DateTime]$StartDate
$EndDate = [DateTime]$EndDate $EndDate = [DateTime]$EndDate
} }
if(-Not(($SpamEmailsSent.IsPresent)-or($SpamEmailsReceived.IsPresent)-or($MalwareEmailsSent.IsPresent)-or($MalwareEmailsReceived.IsPresent))){ if(-Not(($SpamEmailsSent.IsPresent)-or($SpamEmailsReceived.IsPresent)-or($MalwareEmailsSent.IsPresent)-or($MalwareEmailsReceived.IsPresent)-or($PhishEmailsSent.IsPresent)-or($PhishEmailsReceived.IsPresent)-or($IntraorgSpamMails.IsPresent)-or($IntraorgMalwareMails.IsPresent)-or($IntraorgPhishMails.IsPresent))){
Write-Host "Exiting.`nNote: Choose one report to generate. Please try again" -ForegroundColor Red Write-Host "Exiting.`nNote: Choose one report to generate. Please try again" -ForegroundColor Red
Exit Exit
} }
GetSpamMalwareData -StartDate $StartDate -EndDate $EndDate GetSpamMalwarePhishData -StartDate $StartDate -EndDate $EndDate
} }
Function GetSpamMalwareData { Function GetSpamMalwarePhishData {
param ( param (
[DateTime]$StartDate, [DateTime]$StartDate,
[DateTime]$EndDate [DateTime]$EndDate
@ -54,41 +74,94 @@ Function GetSpamMalwareData {
ConnectToExchange ConnectToExchange
$global:ExportedEmails = 0 $global:ExportedEmails = 0
$global:Domain = "Recipient Domain" $global:Domain = "Recipient Domain"
$SpamEventTypes = "URL malicious reputation", "Advanced filter", "General filter", "Mixed analysis detection", "Fingerprint matching", "Domain reputation", "Bulk", "IP reputation"
$PhishEventTypes = "URL malicious reputation", "Advanced filter", "General filter", "Spoof intra-org", "Spoof external domain", "Spoof DMARC", "Impersonation brand", "Mixed analysis detection", "File reputation", "Fingerprint matching", "URL detonation reputation", "URL detonation", "Impersonation user", "Impersonation domain", "Mailbox intelligence impersonation", "File detonation", "File detonation reputation", "Campaign"
$MalwareEventTypes = "File detonation", "File detonation reputation", "File reputation", "Anti-malware engine", "URL malicious reputation", "URL detonation", "URL detonation reputation", "Campaign"
if ($SpamEmailsReceived.IsPresent) { if ($SpamEmailsReceived.IsPresent) {
$global:ExportCSVFileName = ".\SpamEmailsReceivedReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv" $global:ExportCSVFileName = ".\SpamEmailsReceivedReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving spam emails received from $StartDate to $EndDate..." Write-Host "Retrieving spam emails received from $StartDate to $EndDate..."`n
Get-MailDetailSpamReport -StartDate $StartDate -EndDate $EndDate -Direction Inbound -PageSize 5000 | ForEach-Object { Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction Inbound -PageSize 5000 -EventType $SpamEventTypes | Where-Object { $_.VerdictSource -like "Spam"} | ForEach-Object {
$global:Domain = "Sender Domain" $global:Domain = "Sender Domain"
$CurrRecord = $_ $CurrRecord = $_
RetrieveEmailInfo RetrieveEmailInfo
} }
OpenOutputFile
} }
elseif ($MalwareEmailsReceived.IsPresent) { if ($MalwareEmailsReceived.IsPresent) {
$global:ExportCSVFileName = ".\MalwareEmailsReceivedReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv" $global:ExportCSVFileName = ".\MalwareEmailsReceivedReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving malware emails received from $StartDate to $EndDate..." Write-Host "Retrieving malware emails received from $StartDate to $EndDate..."`n
Get-MailDetailMalwareReport -StartDate $StartDate -EndDate $EndDate -Direction Inbound -PageSize 5000 | ForEach-Object { Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction Inbound -PageSize 5000 -EventType $MalwareEventTypes | Where-Object { $_.VerdictSource -like "Malware"} | ForEach-Object {
$global:Domain = "Sender Domain" $global:Domain = "Sender Domain"
$CurrRecord = $_ $CurrRecord = $_
RetrieveEmailInfo RetrieveEmailInfo
} }
OpenOutputFile
} }
elseif ($SpamEmailsSent.IsPresent) { if ($SpamEmailsSent.IsPresent) {
$global:ExportCSVFileName = ".\SpamEmailsSentReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv" $global:ExportCSVFileName = ".\SpamEmailsSentReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving spam emails sent from $StartDate to $EndDate..." Write-Host "Retrieving spam emails sent from $StartDate to $EndDate..."`n
Get-MailDetailSpamReport -StartDate $StartDate -EndDate $EndDate -Direction Outbound -PageSize 5000 | ForEach-Object { Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction Outbound -PageSize 5000 -EventType $SpamEventTypes | Where-Object { $_.VerdictSource -like "Spam"} | ForEach-Object {
$CurrRecord = $_ $CurrRecord = $_
RetrieveEmailInfo RetrieveEmailInfo
} }
OpenOutputFile
} }
elseif ($MalwareEmailsSent.IsPresent) { if ($MalwareEmailsSent.IsPresent) {
$global:ExportCSVFileName = ".\MalwareEmailsSentReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv" $global:ExportCSVFileName = ".\MalwareEmailsSentReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving malware emails sent from $StartDate to $EndDate..." Write-Host "Retrieving malware emails sent from $StartDate to $EndDate..."`n
Get-MailDetailMalwareReport -StartDate $StartDate -EndDate $EndDate -Direction Outbound -PageSize 5000 | ForEach-Object { Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction Outbound -PageSize 5000 -EventType $MalwareEventTypes | Where-Object { $_.VerdictSource -like "Malware"} | ForEach-Object {
$CurrRecord = $_ $CurrRecord = $_
RetrieveEmailInfo RetrieveEmailInfo
} }
} OpenOutputFile
}
if ($PhishEmailsReceived.IsPresent) {
$global:ExportCSVFileName = ".\PhishEmailsReceivedReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving phish emails received from $StartDate to $EndDate..."`n
Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction Inbound -PageSize 5000 -EventType $PhishEventTypes | Where-Object { $_.VerdictSource -like "Phish"} | ForEach-Object {
$global:Domain = "Sender Domain"
$CurrRecord = $_
RetrieveEmailInfo
}
OpenOutputFile
}
if ($PhishEmailsSent.IsPresent) {
$global:ExportCSVFileName = ".\PhishEmailsSentReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving phish emails sent from $StartDate to $EndDate..."`n
Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction Outbound -PageSize 5000 -EventType $PhishEventTypes | Where-Object { $_.VerdictSource -like "Phish"} | ForEach-Object {
$CurrRecord = $_
RetrieveEmailInfo
}
OpenOutputFile
}
if ($IntraorgSpamMails.IsPresent) {
$global:ExportCSVFileName = ".\IntraorgSpamMailsReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving internal spam emails from $StartDate to $EndDate..."`n
Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction IntraOrg -PageSize 5000 -EventType $SpamEventTypes | Where-Object { $_.VerdictSource -like "Spam"} | ForEach-Object {
$CurrRecord = $_
RetrieveEmailInfo
}
OpenOutputFile
}
if ($IntraorgMalwareMails.IsPresent) {
$global:ExportCSVFileName = ".\IntraorgMalwareMailsReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving internal malware emails from $StartDate to $EndDate..."`n
Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction IntraOrg -PageSize 5000 -EventType $MalwareEventTypes | Where-Object { $_.VerdictSource -like "Malware"} | ForEach-Object {
$CurrRecord = $_
RetrieveEmailInfo
}
OpenOutputFile
}
if ($IntraorgPhishMails.IsPresent) {
$global:ExportCSVFileName = ".\IntraorgPhishMailsReport-" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Write-Host "Retrieving internal phish emails from $StartDate to $EndDate..."`n
Get-MailDetailATPReport -StartDate $StartDate -EndDate $EndDate -Direction IntraOrg -PageSize 5000 -EventType $PhishEventTypes | Where-Object { $_.VerdictSource -like "Phish"} | ForEach-Object {
$CurrRecord = $_
RetrieveEmailInfo
}
OpenOutputFile
}
} }
Function ConnectToExchange { Function ConnectToExchange {
$Exchange = (get-module ExchangeOnlineManagement -ListAvailable).Name $Exchange = (get-module ExchangeOnlineManagement -ListAvailable).Name
@ -114,7 +187,7 @@ Function ConnectToExchange {
else { else {
Connect-ExchangeOnline | Out-Null Connect-ExchangeOnline | Out-Null
} }
Write-Host "ExchangeOnline PowerShell module is connected successfully" Write-Host "ExchangeOnline PowerShell module is connected successfully"`n
#End of Connecting Exchange Online #End of Connecting Exchange Online
} }
Function RetrieveEmailInfo { Function RetrieveEmailInfo {
@ -128,7 +201,7 @@ Function RetrieveEmailInfo {
if($CurrRecord.Direction -eq 'Inbound'){ if($CurrRecord.Direction -eq 'Inbound'){
$Domain = $SenderAddress.split("@") | Select-object -Index 1 $Domain = $SenderAddress.split("@") | Select-object -Index 1
} }
else{ elseif($CurrRecord.Direction -eq 'Outbound'){
$Domain = $RecipientAddress.split("@") | Select-object -Index 1 $Domain = $RecipientAddress.split("@") | Select-object -Index 1
} }
ExportResults ExportResults
@ -137,24 +210,32 @@ Function ExportResults {
$global:ExportedEmails = $global:ExportedEmails + 1 $global:ExportedEmails = $global:ExportedEmails + 1
$ExportResult = @{'Date' = $DateTime; 'Sender Address' = $SenderAddress; 'Recipient Address' = $RecipientAddress; 'Subject'= $Subject; 'Event Type' = $EventType; $global:Domain = $Domain} $ExportResult = @{'Date' = $DateTime; 'Sender Address' = $SenderAddress; 'Recipient Address' = $RecipientAddress; 'Subject'= $Subject; 'Event Type' = $EventType; $global:Domain = $Domain}
$ExportResults = New-Object PSObject -Property $ExportResult $ExportResults = New-Object PSObject -Property $ExportResult
$ExportResults | Select-Object 'Date', 'Sender Address', 'Recipient Address', 'Subject', 'Event Type',$global:Domain | Export-csv -path $global:ExportCSVFileName -NoType -Append -Force if(($CurrRecord.Direction -eq 'Inbound')-or($CurrRecord.Direction -eq 'Outbound')){
$ExportResults | Select-Object 'Date', 'Sender Address', 'Recipient Address', 'Subject', 'Event Type',$global:Domain | Export-csv -path $global:ExportCSVFileName -NoType -Append -Force
}
else{
$ExportResults | Select-Object 'Date', 'Sender Address', 'Recipient Address', 'Subject', 'Event Type' | Export-csv -path $global:ExportCSVFileName -NoType -Append -Force
}
}
#Open output file after execution
Function OpenOutputFile{
if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") {
Write-Host " The Output file available in:" -NoNewline -ForegroundColor Yellow; Write-Host $global:ExportCSVFileName
Write-Host `n"The exported report has $global:ExportedEmails email details"
$prompt = New-Object -ComObject wscript.shell
$userInput = $prompt.popup("Do you want to open output file?", 0, "Open Output File", 4)
If ($userInput -eq 6) {
Invoke-Item "$global:ExportCSVFileName"
}
}
else {
Write-Host "No data found with the specified criteria"
}
} }
DateAndSwitchesValidation DateAndSwitchesValidation
#Open output file after execution
if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") {
Write-Host "The output file available in $global:ExportCSVFileName" -ForegroundColor Green
Write-Host "The exported report has $global:ExportedEmails email details"
$prompt = New-Object -ComObject wscript.shell
$userInput = $prompt.popup("Do you want to open output file?", 0, "Open Output File", 4)
If ($userInput -eq 6) {
Invoke-Item "$global:ExportCSVFileName"
}
}
else {
Write-Host "No data found with the specified criteria"
}
Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue
Write-Host "Disconnected active ExchangeOnline session" Write-Host `n"Disconnected active ExchangeOnline session"
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n

View File

@ -4,7 +4,18 @@ Name: Export Office 365 mail traffic statistics by user report
Description: This script exports mails sent, received, spam received and malware received statistics by users to CSV file Description: This script exports mails sent, received, spam received and malware received statistics by users to CSV file
Version: 3.0 Version: 3.0
Website: o365reports.com Website: o365reports.com
Script by: O365Reports Team
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script can generate 5+ email statistics reports like emails sent, emails received, spam received, and malware received count.
2.The script uses modern authentication to connect to Exchange Online.
3.The script can be executed with MFA enabled account too.
4.Exports report results to CSV.
5.Allows you to generate email statistics reports for a custom period.
6.Automatically installs the EXO V2 module (if not installed already) upon your confirmation.
7.Allows you to filter the mail traffic report for organization users alone.
8.The script is scheduler-friendly. i.e., Credentials can be passed as a parameter.
For detailed script execution: https://o365reports.com/2020/08/12/export-office-365-mail-traffic-report-with-powershell/ For detailed script execution: https://o365reports.com/2020/08/12/export-office-365-mail-traffic-report-with-powershell/
============================================================================================ ============================================================================================
#> #>
@ -214,7 +225,7 @@ else
#Connect_Modules #Connect_Modules
Write-Host Getting mail traffic data... Write-Host Getting mail traffic data... `n
#Output file declaration #Output file declaration
$OutputCSV=".\Mail_Traffic_Report_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" $OutputCSV=".\Mail_Traffic_Report_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv"
@ -269,7 +280,10 @@ Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction
if((Test-Path -Path $OutputCSV) -eq "True") if((Test-Path -Path $OutputCSV) -eq "True")
{ {
Write-Host `nThe Output file available in the current working directory with name: $OutputCSV -ForegroundColor Green Write-Host " The Output file available in the current working directory with name:" -NoNewline -ForegroundColor Yellow;
Write-Host $OutputCSV
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)

View File

@ -3,8 +3,19 @@
Name: Microsoft 365 Mailbox Size Report Name: Microsoft 365 Mailbox Size Report
Description: This script exports Microsoft 365 mailbox size report to CSV Description: This script exports Microsoft 365 mailbox size report to CSV
Version: 2.0 Version: 2.0
website: o365reports.com Website: o365reports.com
Script by: O365Reports Team
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script uses modern authentication to connect to Exchange Online.
2.The script can be executed with MFA enabled account too.
3.Exports report results to CSV.
4.You can choose to either export mailbox size of all mailboxes or pass an input file to get usage statistics of specific mailboxes alone.
5.Allows to use filter to get user mailboxes size alone
6.Allows to use filter to get shared mailboxes size alone.
7.Automatically installs the EXO (Exchange Online) V2 module (if not installed already) upon your confirmation.
8.The script is scheduler friendly. I.e., Credential can be passed as a parameter instead of saving inside the script.
For detailed Script execution: https://o365reports.com/2020/10/21/export-office-365-mailbox-size-report-using-powershell/ For detailed Script execution: https://o365reports.com/2020/10/21/export-office-365-mailbox-size-report-using-powershell/
============================================================================================ ============================================================================================
#> #>
@ -163,8 +174,10 @@ Function main()
Write-Host `nThe output file contains $PrintedMBCount mailboxes. Write-Host `nThe output file contains $PrintedMBCount mailboxes.
if((Test-Path -Path $ExportCSV) -eq "True") if((Test-Path -Path $ExportCSV) -eq "True")
{ {
Write-Host `nThe Output file available in $ExportCSV -ForegroundColor Green
$Prompt = New-Object -ComObject wscript.shell Write-Host `n The Output file available in: -NoNewline -ForegroundColor Yellow
Write-Host $ExportCSV
$Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)
If ($UserInput -eq 6) If ($UserInput -eq 6)
@ -175,6 +188,10 @@ Function main()
} }
#Disconnect Exchange Online session #Disconnect Exchange Online session
Disconnect-ExchangeOnline -Confirm:$false | Out-Null Disconnect-ExchangeOnline -Confirm:$false | Out-Null
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
. main . main

View File

@ -3,8 +3,17 @@
Name: Microsoft 365 Group Report Name: Microsoft 365 Group Report
Description: This script exports Microsoft 365 groups and their membership to CSV using Microsoft Graph PowerShell Description: This script exports Microsoft 365 groups and their membership to CSV using Microsoft Graph PowerShell
Version: 3.0 Version: 3.0
website: o365reports.com Website: o365reports.com
Script by: O365Reports Team
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script uses Microsoft Graph PowerShell.
2.The script can be executed with certificate-based authentication (CBA) too.
3.Exports the report result to CSV.
4.You can get members count based on Member Type such as User, Group, Contact, etc.
5.The script is scheduler friendly.
6.Above all, the script exports output to nicely formatted 2 CSV files. One with group information and another with detailed group membership information.
For detailed Script execution: https://o365reports.com/2021/02/11/export-microsoft-365-group-report-to-csv-using-powershell For detailed Script execution: https://o365reports.com/2021/02/11/export-microsoft-365-group-report-to-csv-using-powershell
============================================================================================ ============================================================================================
#> #>
@ -171,9 +180,9 @@ Function main()
$confirm= Read-Host Are you sure you want to install module? [Y] Yes [N] No $confirm= Read-Host Are you sure you want to install module? [Y] Yes [N] No
if($confirm -match "[yY]") if($confirm -match "[yY]")
{ {
Write-host "Installing MicrosoftGraph module..." Write-host `n"Installing MicrosoftGraph module..."
Install-Module Microsoft.Graph -Repository PsGallery -Force -AllowClobber -Scope CurrentUser Install-Module Microsoft.Graph -Repository PsGallery -Force -AllowClobber -Scope CurrentUser
Write-host "Required Module is installed in the machine Successfully" -ForegroundColor Magenta Write-host `n"Required Module is installed in the machine Successfully" -ForegroundColor Magenta
} }
else else
{ {
@ -181,7 +190,7 @@ Function main()
Exit Exit
} }
} }
Write-Host "Connecting to Microsoft Graph..." Write-Host `n"Connecting to Microsoft Graph..."`n
$Scopes = @("Directory.Read.All" $Scopes = @("Directory.Read.All"
) )
#Storing credential in script for scheduling purpose/ Passing credential as parameter #Storing credential in script for scheduling purpose/ Passing credential as parameter
@ -194,7 +203,7 @@ Function main()
} }
catch catch
{ {
Write-Host "Please provide Correct Details!" -ForegroundColor Red Write-Host `n"Please provide Correct Details!" -ForegroundColor Red
Exit Exit
} }
} }
@ -202,7 +211,7 @@ Function main()
{ {
Connect-MgGraph -Scopes $Scopes Connect-MgGraph -Scopes $Scopes
} }
Write-Host "Microsoft graph connected" -ForegroundColor Green Write-Host `n"Microsoft Graph connected" -ForegroundColor Green
#Set output file #Set output file
$ExportCSV=".\M365Group-DetailedMembersReport_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" #Detailed report $ExportCSV=".\M365Group-DetailedMembersReport_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" #Detailed report
$ExportSummaryCSV=".\M365Group-SummaryReport_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" #Summary report $ExportSummaryCSV=".\M365Group-SummaryReport_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" #Summary report
@ -241,11 +250,15 @@ Function main()
} }
#Open output file after execution #Open output file after execution
Write-Host "Script executed successfully" -ForegroundColor Green Write-Host `n"Script executed successfully"
if((Test-Path -Path $ExportCSV) -eq "True") if((Test-Path -Path $ExportCSV) -eq "True")
{ {
Write-Host Detailed report available in: $ExportCSV -ForegroundColor Magenta Write-Host `n" Detailed report available in:" -NoNewline -ForegroundColor Yellow
Write-host Summary report available in: $ExportSummaryCSV -ForegroundColor Magenta Write-Host $ExportCSV
Write-host `n" Summary report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportSummaryCSV
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` 0,"Open Output File",4) $UserInput = $Prompt.popup("Do you want to open output file?",` 0,"Open Output File",4)
If ($UserInput -eq 6) If ($UserInput -eq 6)
@ -257,7 +270,7 @@ Function main()
} }
Else Else
{ {
Write-Host "No group found" -ForegroundColor Red Write-Host `n"No group found" -ForegroundColor Red
CloseConnection CloseConnection
} }
} }

View File

@ -1,4 +1,25 @@
#Accept input paramenters <#
=============================================================================================
Name: Export Microsoft Teams report
Description: This script exports Microsoft Teams report to CSV
Version: 2.0
website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1.A single script allows you to generate eight different Teams reports.
2.The script can be executed with MFA enabled accounts too.
3.Exports output to CSV.
4.Automatically installs Microsoft Teams PowerShell module (if not installed already) upon your confirmation.
5.The script is scheduler friendly. I.e., Credential can be passed as a parameter instead of saving inside the script.
For detailed Script execution: https://o365reports.com/2020/05/28/microsoft-teams-reporting-using-powershell/
============================================================================================
#>
#Accept input paramenters
param( param(
[string]$UserName, [string]$UserName,
[string]$Password, [string]$Password,
@ -80,6 +101,8 @@ Do {
Write-Host `nPrivate Channel Management and Reporting -ForegroundColor Yellow Write-Host `nPrivate Channel Management and Reporting -ForegroundColor Yellow
Write-Host " You can download the script from https://blog.admindroid.com/managing-private-channels-in-microsoft-teams/" -ForegroundColor Cyan Write-Host " You can download the script from https://blog.admindroid.com/managing-private-channels-in-microsoft-teams/" -ForegroundColor Cyan
Write-Host "" Write-Host ""
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$i = Read-Host 'Please choose the action to continue' $i = Read-Host 'Please choose the action to continue'
} }
else else
@ -286,7 +309,11 @@ Do {
} }
if((Test-Path -Path $Path) -eq "True") if((Test-Path -Path $Path) -eq "True")
{ {
Write-Host `nReport available in $Path -ForegroundColor Green Write-Host ""
Write-Host "Report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $Path
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
} }

View File

@ -3,6 +3,23 @@
Name: Get distribution group members report Name: Get distribution group members report
Version: 3.0 Version: 3.0
Website: o365reports.com Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script uses modern authentication to connect to Exchange Online.
2.Allows you to filter the report result based on group size(i.e., Members count).
3.The script can be executed with MFA enabled account too.
4.You can choose to either Export Members of all Distribution Lists or pass an input file to Export Members of Specific Distribution List.
5.You can filter the output based on whether the group accepts message from external senders or not.
6.Exports the list of allowed senders to a Distribution List.
7.Output can be filtered to list Empty group. i.e., Distribution Group without members
8.Exports the report result to CSV.
9.You can get members count based on Member Type such as User mailbox, Group mailbox, Shared mailbox, Contact, etc.
10.Automatically installs the EXO V2 (if not installed already) upon your confirmation.
11.The script is scheduler friendly. i.e., credentials can be passed as parameter instead of saving inside the script.
12.Above all, script exports output in nicely formatted 2 CSV files. One with detailed information and another with summary information.
For detailed script execution: https://o365reports.com/2019/05/23/export-office-365-distribution-group-members-csv/ For detailed script execution: https://o365reports.com/2019/05/23/export-office-365-distribution-group-members-csv/
============================================================================================ ============================================================================================
#> #>
@ -224,9 +241,12 @@ Function main()
Write-Host `nScript executed successfully Write-Host `nScript executed successfully
if((Test-Path -Path $ExportCSV) -eq "True") if((Test-Path -Path $ExportCSV) -eq "True")
{ {
Write-Host Detailed report available in: $ExportCSV Write-Host `n" Detailed report available in:" -NoNewline -ForegroundColor Yellow
Write-host Summary report available in: $ExportSummaryCSV Write-Host $ExportCSV `n
Write-Host `nCheck out """AdminDroid Office 365 Reporting tool""" to get access to 1500+ Office 365 reports.`n -ForegroundColor Green Write-host " Summary report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportSummaryCSV
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)

View File

@ -3,7 +3,35 @@
Name: Export Dynamic Distribution Group Members Report Name: Export Dynamic Distribution Group Members Report
Version: 2.0 Version: 2.0
Website: o365reports.com Website: o365reports.com
Script by: O365Reports Team
Script Highlights:
~~~~~~~~~~~~~~~~~~
1.The script can be executed with MFA enabled account.
2.Allows you to filter the output based on group size (i.e., Members count).
3.You can choose to either export members of all Dynamic Distribution Groups or pass an input file to get members of specific groups alone.
4.Output can be filtered to list Empty group. i.e., DDL without members
5.Exports the result to CSV
6.You can get members count based on Member Type such as user mailbox, Group mailbox, shared mailbox, contact, etc
7.Above all, script stores output in nicely formatted 2 CSV files. One with detailed information and another with summary information.
8.Dynamic Distribution Group Summary Report : Following are the columns available
a.Group Display Name,
b.Primary SMTP Address,
c.Group Alias,
d.Group Manager,
e.Hidden From Address List,
f.Group Members Count,
g.Members Count by Type
9.Dynamic Distribution Group Detailed Members Report : Following are the columns available
a.Group Display Name,
b.Primary SMTP Address,
c.Group Alias,
d.Group Manager,
e.Group Members Count,
f.Group Members,
g.Member Email Address
h.Member Type
For detailed script execution: https://o365reports.com/2019/03/23/export-dynamic-distribution-group-members-to-csv/ For detailed script execution: https://o365reports.com/2019/03/23/export-dynamic-distribution-group-members-to-csv/
============================================================================================ ============================================================================================
#> #>
@ -229,8 +257,13 @@ Function main()
Write-Host `nScript executed successfully Write-Host `nScript executed successfully
if((Test-Path -Path $ExportCSV) -eq "True") if((Test-Path -Path $ExportCSV) -eq "True")
{ {
Write-Host Detailed report available in: $ExportCSV Write-Host ""
Write-host Summary report available in: $ExportSummaryCSV Write-Host " Detailed report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportCSV `n
Write-host " Summary report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportSummaryCSV
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)
@ -244,7 +277,6 @@ Function main()
{ {
Write-Host No DynamicDistributionGroup found Write-Host No DynamicDistributionGroup found
} }
Write-Host "For more Office 365 reports, do check AdminDroid Office 365 reporting tool." -ForegroundColor Cyan
#Clean up session #Clean up session
Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue
} }

View File

@ -1,3 +1,24 @@
<#
=============================================================================================
Name: Export Office 365 Email Forwarding Report using PowerShell
Description: This script exports Office 365 email forwarding report to CSV format
Version: 1.0
Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1.Generates 3 different email forwarding rules reports.
2.Automatically installs the Exchange Online module upon your confirmation when it is not available in your machine.
3.Shows mailboxes in which email forwarding configured through Forwarding SMTP Address and Forward To.
4.Lists all inbox rules that forward email to others mailbox.
5.Identifies transport rule that redirects emails to mailboxes
6.Supports both MFA and Non-MFA accounts.
7.Exports the report in CSV format.
8.The script is scheduler-friendly. You can automate the report generation upon passing credentials as parameters.
For detailed script execution: https://o365reports.com/2021/06/09/export-office-365-email-forwarding-report-using-powershell/
============================================================================================
#>
param( param(
[string] $UserName = $null, [string] $UserName = $null,
@ -18,7 +39,7 @@ Function GetPrintableValue($RawData) {
} }
Function GetAllMailForwardingRules { Function GetAllMailForwardingRules {
Write-host "Preparing the Email Forwarding Report..." Write-host `n"Preparing the Email Forwarding Report..."
if($InboxRules.IsPresent) { if($InboxRules.IsPresent) {
$global:ExportCSVFileName = "InboxRulesWithEmailForwarding_" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv" $global:ExportCSVFileName = "InboxRulesWithEmailForwarding_" + ((Get-Date -format "MMM-dd hh-mm-ss tt").ToString()) + ".csv"
Get-Mailbox -ResultSize Unlimited | ForEach-Object { Get-Mailbox -ResultSize Unlimited | ForEach-Object {
@ -143,9 +164,9 @@ $global:ReportSize = 0
GetAllMailForwardingRules GetAllMailForwardingRules
Write-Progress -Activity "--" -Completed Write-Progress -Activity "--" -Completed
Write-Host "`nFor more Office 365 PowerShell scripts, please visit O365reports.com" -ForegroundColor cyan
if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") { if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") {
Write-Host "The output file available in $global:ExportCSVFileName" -ForegroundColor Green Write-Host `n" The output file available in:" -NoNewline -ForegroundColor Yellow
Write-Host .\$global:ExportCSVFileName `n
Write-Host "The exported report has $global:ReportSize email forwarding configurations" Write-Host "The exported report has $global:ReportSize email forwarding configurations"
$prompt = New-Object -ComObject wscript.shell $prompt = New-Object -ComObject wscript.shell
$userInput = $prompt.popup("Do you want to open output file?", 0, "Open Output File", 4) $userInput = $prompt.popup("Do you want to open output file?", 0, "Open Output File", 4)
@ -157,5 +178,7 @@ else {
Write-Host "No data found with the specified criteria" Write-Host "No data found with the specified criteria"
} }
Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue
Write-Host "Disconnected active ExchangeOnline session" Write-Host `n"Disconnected active ExchangeOnline session"
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n

View File

@ -1,4 +1,23 @@
Param <#
=============================================================================================
Name: Export Non-Owner Mailbox Access Report
Version: 2.0
Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~~
1.Allows you to filter out external users access.
2.The script can be executed with MFA enabled account too.
3.Exports the report to CSV
4.This script is scheduler friendly. I.e., credentials can be passed as a parameter instead of saving inside the script.
5.You can narrow down the audit search for a specific date range.
For detailed script execution: https://o365reports.com/2020/02/04/export-non-owner-mailbox-access-report-to-csv/
============================================================================================
#>
Param
( (
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[switch]$MFA, [switch]$MFA,
@ -241,7 +260,10 @@ else
Write-Host `nThe output file contains $NonOwnerAccess audit records Write-Host `nThe output file contains $NonOwnerAccess audit records
if((Test-Path -Path $OutputCSV) -eq "True") if((Test-Path -Path $OutputCSV) -eq "True")
{ {
Write-Host `nThe Output file available in $OutputCSV -ForegroundColor Green Write-Host `nThe Output file available in: -NoNewline -ForegroundColor Yellow
Write-Host $OutputCSV
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)

View File

@ -1,12 +1,31 @@
#Accept input paramenters <#
=============================================================================================
Name: Get Shared Mailbox Permission Report
Version: 2.0
Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~~
1.The script display only Explicitly assigned permissions to mailboxes which means it will ignore SELF permission that each user on his mailbox and inherited permission.
2.Exports output to CSV file.
3.The script can be executed with MFA enabled account also.
4.You can choose to either export permissions of all mailboxes or pass an input file to get permissions of specific mailboxes alone.
5.Allows you to filter output using your desired permissions like Send-as, Send-on-behalf or Full access.
6.This script is scheduler friendly. I.e., credentials can be passed as a parameter instead of saving inside the script
For detailed script execution: https://o365reports.com/2020/01/03/shared-mailbox-permission-report-to-csv/
============================================================================================
#>
#Accept input paramenters
param( param(
[switch]$FullAccess, [switch]$FullAccess,
[switch]$SendAs, [switch]$SendAs,
[switch]$SendOnBehalf, [switch]$SendOnBehalf,
[string]$MBNamesFile, [string]$MBNamesFile,
[string]$UserName, [string]$UserName,
[string]$Password, [string]$Password
[switch]$MFA
) )
@ -110,68 +129,35 @@ function Get_MBPermission
} }
function main{ function main{
#Connect AzureAD and Exchange Online from PowerShell #Check for Exchange Online management module inatallation
Get-PSSession | Remove-PSSession $Module = Get-Module ExchangeOnlineManagement -ListAvailable
if($Module.count -eq 0)
#Authentication using MFA {
if($MFA.IsPresent) Write-Host Exchange Online PowerShell V2 module is not available -ForegroundColor yellow
{ $Confirm= Read-Host Are you sure you want to install module? [Y] Yes [N] No
$MFAExchangeModule = ((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter CreateExoPSSession.ps1 -Recurse ).FullName | Select-Object -Last 1) if($Confirm -match "[yY]")
If ($MFAExchangeModule -eq $null) {
{ Write-host "Installing Exchange Online PowerShell module"
Write-Host `nPlease install Exchange Online MFA Module. -ForegroundColor yellow Install-Module ExchangeOnlineManagement -Repository PSGallery -AllowClobber -Force
Write-Host You can install module using below blog :https://o365reports.com/2019/04/17/connect-exchange-online-using-mfa/ `n `nOR you can install module directly by entering "Y"`n Import-Module ExchangeOnlineManagement
$Confirm= Read-Host Are you sure you want to install module directly? [Y] Yes [N] No }
if($Confirm -match "[y]") else
{ {
Write-Host Yes Write-Host EXO V2 module is required to connect Exchange Online.Please install module using Install-Module ExchangeOnlineManagement cmdlet.
Start-Process "iexplore.exe" "https://cmdletpswmodule.blob.core.windows.net/exopsmodule/Microsoft.Online.CSE.PSModule.Client.application" Exit
}
else
{
Start-Process 'https://o365reports.com/2019/04/17/connect-exchange-online-using-mfa/'
Exit
}
$Confirmation= Read-Host Have you installed Exchange Online MFA Module? [Y] Yes [N] No
if($Confirmation -match "[y]")
{
$MFAExchangeModule = ((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter CreateExoPSSession.ps1 -Recurse ).FullName | Select-Object -Last 1)
If ($MFAExchangeModule -eq $null)
{
Write-Host Exchange Online MFA module is not available -ForegroundColor red
Exit
}
}
else
{
Write-Host Exchange Online PowerShell Module is required
Start-Process 'https://o365reports.com/2019/04/17/connect-exchange-online-using-mfa/'
Exit
}
} }
}
#Importing Exchange MFA Module Write-Host Connecting to Exchange Online...
. "$MFAExchangeModule" #Storing credential in script for scheduling purpose/ Passing credential as parameter - Authentication using non-MFA account
Connect-EXOPSSession -WarningAction SilentlyContinue if(($UserName -ne "") -and ($Password -ne ""))
Write-Host `nReport generation in progress... {
$SecuredPassword = ConvertTo-SecureString -AsPlainText $Password -Force
$Credential = New-Object System.Management.Automation.PSCredential $UserName,$SecuredPassword
Connect-ExchangeOnline -Credential $Credential
} }
#Authentication using non-MFA
else else
{ {
#Storing credential in script for scheduling purpose/ Passing credential as parameter Connect-ExchangeOnline
if(($UserName -ne "") -and ($Password -ne ""))
{
$SecuredPassword = ConvertTo-SecureString -AsPlainText $Password -Force
$Credential = New-Object System.Management.Automation.PSCredential $UserName,$SecuredPassword
}
else
{
$Credential=Get-Credential -Credential $null
}
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credential -Authentication Basic -AllowRedirection
Import-PSSession $Session -CommandName Get-Mailbox,Get-MailboxPermission,Get-RecipientPermission -FormatTypeName * -AllowClobber | Out-Null
} }
#Set output file #Set output file
@ -219,7 +205,11 @@ function main{
Write-Host `nScript executed successfully Write-Host `nScript executed successfully
if((Test-Path -Path $ExportCSV) -eq "True") if((Test-Path -Path $ExportCSV) -eq "True")
{ {
Write-Host "Detailed report available in: $ExportCSV" -ForegroundColor Green Write-Host ""
Write-Host " Detailed report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportCSV
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)

View File

@ -4,6 +4,21 @@ Name: Export Office 365 users real last activity time report
Version: 3.0 Version: 3.0
Website: o365reports.com Website: o365reports.com
Script by: O365Reports Team Script by: O365Reports Team
Script Highlights:
~~~~~~~~~~~~~~~~~
1.Reports the users activity time based on the users last action time(LastUserActionTime).
2.Exports result to CSV file.
3.Result can be filtered based oninactive days.
4.You can filter the result based onuser/mailbox type.
5.Result can be filtered to listnever logged in mailboxesalone.
6.You can filter the result based on licensed user.
7.Shows result withthe users administrative rolesin the Office 365.
8.The assigned licenses column will show you theuser-friendly-namelike Office 365 Enterprise E3 rather than ENTERPRISEPACK.
9.The script can be executed withMFA enabled account.
10.The script is scheduler friendly. i.e., credentials can be passed as a parameter instead of saving inside the script.
For detailed script execution: https://o365reports.com/2019/06/18/export-office-365-users-real-last-logon-time-report-csv/# For detailed script execution: https://o365reports.com/2019/06/18/export-office-365-users-real-last-logon-time-report-csv/#
============================================================================================ ============================================================================================
#> #>
@ -265,7 +280,10 @@ Function main()
Write-Host `nScript executed successfully Write-Host `nScript executed successfully
if((Test-Path -Path $ExportCSV) -eq "True") if((Test-Path -Path $ExportCSV) -eq "True")
{ {
Write-Host "Detailed report available in: $ExportCSV" Write-Host `n" Detailed report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportCSV
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)

View File

@ -3,6 +3,21 @@
Name: Office 365 User Login History Report Name: Office 365 User Login History Report
Website: o365reports.com Website: o365reports.com
Version: 3.0 Version: 3.0
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script uses modern authentication to connect to Exchange Online.
2.Allows you to filter the result based on successful and failed logon attempts.
3.The exported report has IP addresses from where your office 365 users are login.
4.This script can be executed with MFA enabled account.
5.You can export the report to choose either All Office 365 users login attempts or Specific Office users logon attempts.
6.By using advanced filtering options, you can export Office 365 users Sign-in report and Suspicious login report.
7.Exports report result to CSV.
8.Automatically installs the EXO V2 module (if not installed already) upon your confirmation.
9.This script is scheduler friendly. I.e., credentials can be passed as a parameter instead of saving inside the script.
10.Our Logon history report tracks login events in AzureActiveDirectory (UserLoggedIn, UserLoginFailed), ExchangeOnline (MailboxLogin) and MicrosoftTeams (TeamsSessionStarted).
For detailed Script execution: https://o365reports.com/2019/12/23/export-office-365-users-logon-history-report/ For detailed Script execution: https://o365reports.com/2019/12/23/export-office-365-users-logon-history-report/
============================================================================================ ============================================================================================
#> #>
@ -189,7 +204,12 @@ else
{ {
if((Test-Path -Path $OutputCSV) -eq "True") if((Test-Path -Path $OutputCSV) -eq "True")
{ {
Write-Host `nThe Output file availble in $OutputCSV -ForegroundColor Green Write-Host ""
Write-Host " The Output file availble in:" -NoNewline -ForegroundColor Yellow
Write-Host $OutputCSV
Write-Host `nThe output file contains $AggregateResults audit records
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
Write-Host `nThe output file contains $AggregateResults audit records
} }

View File

@ -1,4 +1,28 @@
Param <#
=============================================================================================
Name: Export Office 365 MFA status report
Description: This script exports Microsoft 365 MFA status report to CSV
Version: 2.2
website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The result can be filtered based on MFA status. i.e., you can filter MFA enabled users/enforced users/disabled users alone. For example using the EnabledOnly flag you shall export Office 365 users MFA enabled status to CSV file.
2.Exports result to CSV file.
3.Result can be filtered based on Admin users.
4.You can filter result to display Licensed users alone.
5.You can filter result based on SignIn Status (SignIn allowed/denied).
6.The script produces different output files based on MFA status.
7.You can use this script to get users MFA status set by Conditional Access.
8.The script can be executed with MFA enabled account.
9.Using the Admin Roles column, you can find users with admin roles that are not protected with MFA. For example, you can find Global Admins without MFA.
10.The script is scheduler friendly. i.e., credentials can be passed as parameter instead of saving inside the script.
For detailed Script execution: https://o365reports.com/2019/05/09/export-office-365-users-mfa-status-csv
============================================================================================
#>
Param
( (
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[switch]$DisabledOnly, [switch]$DisabledOnly,
@ -191,9 +215,11 @@ Get-MsolUser -All | foreach{
#Open output file after execution #Open output file after execution
Write-Host `nScript executed successfully Write-Host `nScript executed successfully
if((Test-Path -Path $ExportCSV) -eq "True") if((Test-Path -Path $ExportCSV) -eq "True")
{ {
Write-Host "MFA Disabled user report available in: $ExportCSV" Write-Host " MFA Disabled user report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportCSV `n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)
@ -205,7 +231,9 @@ if((Test-Path -Path $ExportCSV) -eq "True")
} }
elseif((Test-Path -Path $ExportCSVReport) -eq "True") elseif((Test-Path -Path $ExportCSVReport) -eq "True")
{ {
Write-Host "MFA Enabled user report available in: $ExportCSVReport" Write-Host ""
Write-Host " MFA Enabled user report available in:" -NoNewline -ForegroundColor Yellow
Write-Host $ExportCSVReport `n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)
@ -213,11 +241,15 @@ elseif((Test-Path -Path $ExportCSVReport) -eq "True")
{ {
Invoke-Item "$ExportCSVReport" Invoke-Item "$ExportCSVReport"
} }
Write-Host Exported report has $PrintedUser users Write-Host Exported report has $PrintedUser users
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n `n
} }
Else Else
{ {
Write-Host No user found that matches your criteria. Write-Host No user found that matches your criteria.
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n `n
} }
#Clean up session #Clean up session
Get-PSSession | Remove-PSSession Get-PSSession | Remove-PSSession

View File

@ -1,3 +1,25 @@
<#
=============================================================================================
Name: Export Office 365 User's Manager Report
Description: This script exports Office 365 users and their manager to CSV
Version: 1.0
Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1.Generates 10+ different manager reports to view the managers and direct reports status.
2.Automatically installs the Azure AD module upon your confirmation when it is not available in your machine.
3.Shows list of all Azure AD users and their manager.
4.List of all Office 365 users with no manager.
5.Allows specifying user departments to get their manager details.
6.You can get the direct reports of the Office 365 managers.
7.Supports both MFA and Non-MFA accounts.
8.Exports the report in CSV format.
9.Scheduler-friendly. You can automate the report generation upon passing credentials as parameters.
For detailed Script execution: https://o365reports.com/2021/07/13/export-office-365-user-manager-and-direct-reports-using-powershell
============================================================================================
#>
param ( param (
[string] $UserName = $null, [string] $UserName = $null,
@ -19,7 +41,7 @@ Function ConnectToAzureAD {
if ($confirm -match "[yY]") { if ($confirm -match "[yY]") {
Write-host "Installing AzureAD" Write-host "Installing AzureAD"
Install-Module AzureAd -Allowclobber -Repository PSGallery -Force Install-Module AzureAd -Allowclobber -Repository PSGallery -Force
Write-host "AzureAD module is installed in the system successfully." Write-host `n"AzureAD module is installed in the system successfully."
} }
else { else {
Write-host "Exiting. `nNote: AzureAD PowerShell module must be available in your system to run the script." Write-host "Exiting. `nNote: AzureAD PowerShell module must be available in your system to run the script."
@ -37,7 +59,8 @@ Function ConnectToAzureAD {
else { else {
Connect-AzureAD | Out-Null Connect-AzureAD | Out-Null
} }
Write-Host "AzureAD PowerShell module is connected successfully" Write-Host `n"AzureAD PowerShell module is connected successfully"
Write-Host ""
#End of Connecting AzureAD #End of Connecting AzureAD
} }
@ -77,13 +100,13 @@ Function FindUseCase {
if ($UseCaseFilter -ne $null) { if ($UseCaseFilter -ne $null) {
#Filters the users to generate report #Filters the users to generate report
$UseCaseFilter = [ScriptBlock]::Create($UseCaseFilter) $UseCaseFilter = [ScriptBlock]::Create($UseCaseFilter)
Get-AzureADUser | Where-Object $UseCaseFilter | foreach-object { Get-AzureADUser -All $true | Where-Object $UseCaseFilter | foreach-object {
$CurrUserData = $_ $CurrUserData = $_
ProcessUserData ProcessUserData
} }
} else { } else {
#No Filter- Gets all the users without any filter #No Filter- Gets all the users without any filter
Get-AzureADUser | foreach-object { Get-AzureADUser -All $true | foreach-object {
$CurrUserData = $_ $CurrUserData = $_
ProcessUserData ProcessUserData
} }
@ -222,7 +245,8 @@ FindUseCase
if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") { if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") {
#Open file after code execution finishes #Open file after code execution finishes
Write-Host "The output file available in $global:ExportCSVFileName" -ForegroundColor Green Write-Host "The output file available in:" -NoNewline -ForegroundColor Yellow
Write-Host .\$global:ExportCSVFileName `n
write-host "Exported $global:ExportedUser records to CSV." write-host "Exported $global:ExportedUser records to CSV."
$prompt = New-Object -ComObject wscript.shell $prompt = New-Object -ComObject wscript.shell
$userInput = $prompt.popup("Do you want to open output file?", 0, "Open Output File", 4) $userInput = $prompt.popup("Do you want to open output file?", 0, "Open Output File", 4)
@ -231,8 +255,10 @@ if ((Test-Path -Path $global:ExportCSVFileName) -eq "True") {
} }
} else { } else {
#Notification when usecase doesn't have the data in the tenant #Notification when usecase doesn't have the data in the tenant
Write-Host "No data found with the specified criteria" Write-Host `n"No data found with the specified criteria"
} }
Write-Host `nFor more Microsoft 365 reports"," please check o365reports.com -ForegroundColor Cyan Write-Host `nFor more Microsoft 365 reports"," please check o365reports.com -ForegroundColor Cyan
Disconnect-AzureAD Disconnect-AzureAD
Write-host "`nDisconnected AzureAD Session Successfully" Write-host "`nDisconnected AzureAD Session Successfully"
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n

View File

@ -1,4 +1,23 @@
 <#
=============================================================================================
Name: Office 365 license reporting and management tool
Description: This script can perform 10+ Office 365 reporting and management activities
Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1. Generates 5 Office 365 license reports.
2. Allows to perform 6 license management actions that includes, adding or removing licenses in bulk.
3. License Name is shown with its friendly name like Office 365 Enterprise E3 rather than ENTERPRISEPACK.
4. The script can be executed with an MFA enabled account too.
5. Exports the report result to CSV.
6. Exports license assignment and removal log file.
7. The script is scheduler-friendly. i.e., you can pass the credentials as a parameter instead of saving them inside the script.
For detailed Script execution: https://o365reports.com/2021/11/23/office-365-license-reporting-and-management-using-powershell
============================================================================================
#>
Param Param
( (
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
@ -17,14 +36,19 @@ Function Open_OutputFile
{ {
if($ActionFlag -eq "Report") if($ActionFlag -eq "Report")
{ {
Write-Host Detailed license report is available in: $OutputCSVName -Foregroundcolor Green Write-Host " Detailed license report is available in:" -NoNewline -ForegroundColor Yellow; Write-Host $OutputCSVName `n
Write-Host The report has $ProcessedCount records Write-Host The report has $ProcessedCount records
} Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline;
Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
}
elseif($ActionFlag -eq "Mgmt") elseif($ActionFlag -eq "Mgmt")
{ {
Write-Host License assignment/removal log file is available in: $OutputCSVName -ForegroundColor Green Write-Host " License assignment/removal log file is available in:" -NoNewline -ForegroundColor Yellow; Write-Host $OutputCSVName
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline;
Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
Write-Host `nFor more Office 365 related PowerShell scripts, check https://o365reports.com -ForegroundColor Cyan
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)
@ -35,7 +59,10 @@ Function Open_OutputFile
} }
Else Else
{ {
Write-Host No records found Write-Host `nNo records found
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline;
Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
Write-Progress -Activity Export CSV -Completed Write-Progress -Activity Export CSV -Completed
} }
@ -178,7 +205,7 @@ Function main()
Switch ($GetAction) { Switch ($GetAction) {
1 { 1 {
$OutputCSVName=".\O365UserLicenseReport_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" $OutputCSVName=".\O365UserLicenseReport_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv"
Write-Host Generating licensed users report... Write-Host `nGenerating licensed users report...`n
$ProcessedCount=0 $ProcessedCount=0
Get-MsolUser -All | where {$_.IsLicensed -eq $true} | foreach { Get-MsolUser -All | where {$_.IsLicensed -eq $true} | foreach {
$ProcessedCount++ $ProcessedCount++
@ -195,7 +222,7 @@ Function main()
2 { 2 {
$OutputCSVName=".\O365UnlicenedUserReport_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" $OutputCSVName=".\O365UnlicenedUserReport_$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv"
Write-Host Generating Unlicensed users report... Write-Host `nGenerating Unlicensed users report...`n
$ProcessedCount=0 $ProcessedCount=0
Get-MsolUser -All -UnlicensedUsersOnly | foreach { Get-MsolUser -All -UnlicensedUsersOnly | foreach {
$ProcessedCount++ $ProcessedCount++
@ -213,9 +240,9 @@ Function main()
$OutputCSVName="./O365UsersWithSpecificLicenseReport__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" $OutputCSVName="./O365UsersWithSpecificLicenseReport__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv"
if($LicenseName -eq "") if($LicenseName -eq "")
{ {
$LicenseName=Read-Host "Enter the license SKU(Eg:contoso:Enterprisepack)" $LicenseName=Read-Host "`nEnter the license SKU(Eg:contoso:Enterprisepack)"
} }
Write-Host Getting users with $LicenseName license... Write-Host `nGetting users with $LicenseName license...`n
$ProcessedCount=0 $ProcessedCount=0
if((Get-MsolAccountSku).AccountSkuID -icontains $LicenseName) if((Get-MsolAccountSku).AccountSkuID -icontains $LicenseName)
{ {
@ -242,7 +269,7 @@ Function main()
4 { 4 {
$OutputCSVName="./O365DiabledUsersWithLicense__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" $OutputCSVName="./O365DiabledUsersWithLicense__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv"
$ProcessedCount=0 $ProcessedCount=0
Write-Host Finding disabled users still licensed in Office 365... Write-Host `nFinding disabled users still licensed in Office 365...`n
Get-MsolUser -All -EnabledFilter DisabledOnly | where {$_.IsLicensed -eq $true} | foreach { Get-MsolUser -All -EnabledFilter DisabledOnly | where {$_.IsLicensed -eq $true} | foreach {
$ProcessedCount++ $ProcessedCount++
Get_UserInfo Get_UserInfo
@ -261,7 +288,7 @@ Function main()
5 { 5 {
$OutputCSVName="./Office365LicenseUsageReport__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv" $OutputCSVName="./Office365LicenseUsageReport__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).csv"
Write-Host Generating Office 365 license usage report... Write-Host `nGenerating Office 365 license usage report...`n
$ProcessedCount=0 $ProcessedCount=0
Get-MsolAccountSku | foreach { Get-MsolAccountSku | foreach {
$ProcessedCount++ $ProcessedCount++
@ -284,14 +311,14 @@ Function main()
6 { 6 {
$OutputCSVName="./Office365LicenseAssignment_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt" $OutputCSVName="./Office365LicenseAssignment_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt"
$UserNamesFile=Read-Host "Enter the CSV file containing user names(Eg:D:/UserNames.csv)" $UserNamesFile=Read-Host "`nEnter the CSV file containing user names(Eg:D:/UserNames.csv)"
#We have an input file, read it into memory #We have an input file, read it into memory
$UserNames=@() $UserNames=@()
$UserNames=Import-Csv -Header "UPN" $UserNamesFile $UserNames=Import-Csv -Header "UPN" $UserNamesFile
$ProcessedCount=0 $ProcessedCount=0
$LicenseNames=Read-Host "Enter the license name(Eg:contoso:Enterprisepack)" $LicenseNames=Read-Host "`nEnter the license name(Eg:contoso:Enterprisepack)"
Write-Host Assigning license to users... Write-Host `nAssigning license to users...`n
if((Get-MsolAccountSku).AccountSkuID -icontains $LicenseNames) if((Get-MsolAccountSku).AccountSkuID -icontains $LicenseNames)
{ {
foreach($Item in $UserNames) foreach($Item in $UserNames)
@ -323,14 +350,14 @@ Function main()
7 { 7 {
$OutputCSVName="./Office365LicenseAssignment_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt" $OutputCSVName="./Office365LicenseAssignment_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt"
$UserNamesFile=Read-Host "Enter the CSV file containing user names(Eg:D:/UserNames.csv)" $UserNamesFile=Read-Host "`nEnter the CSV file containing user names(Eg:D:/UserNames.csv)"
#We have an input file, read it into memory #We have an input file, read it into memory
$UserNames=@() $UserNames=@()
$UserNames=Import-Csv -Header "UPN" $UserNamesFile $UserNames=Import-Csv -Header "UPN" $UserNamesFile
$Flag="" $Flag=""
$ProcessedCount=0 $ProcessedCount=0
$LicenseNames=Read-Host "Enter the license names(Eg:TenantName:LicensePlan1,TenantName:LicensePlan2)" $LicenseNames=Read-Host "`nEnter the license names(Eg:TenantName:LicensePlan1,TenantName:LicensePlan2)"
$LicenseNames=$LicenseNames.Replace(' ','') $LicenseNames=$LicenseNames.Replace(' ','')
$LicenseNames=$LicenseNames.split(",") $LicenseNames=$LicenseNames.split(",")
foreach($LicenseName in $LicenseNames) foreach($LicenseName in $LicenseNames)
@ -343,11 +370,11 @@ Function main()
} }
if($Flag -eq "Terminate") if($Flag -eq "Terminate")
{ {
Write-Host Please re-run the script with appropriate license name -ForegroundColor Yellow Write-Host `nPlease re-run the script with appropriate license name -ForegroundColor Yellow
} }
else else
{ {
Write-Host Assigning licenses to Office 365 users... Write-Host `nAssigning licenses to Office 365 users...`n
foreach($Item in $UserNames) foreach($Item in $UserNames)
{ {
$UPN=$Item.UPN $UPN=$Item.UPN
@ -373,7 +400,7 @@ Function main()
8 { 8 {
$Identity=Read-Host Enter User UPN $Identity=Read-Host `nEnter User UPN
$UserInfo=Get-MsolUser -UserPrincipalName $Identity $UserInfo=Get-MsolUser -UserPrincipalName $Identity
#Checking whether the user is available #Checking whether the user is available
if($UserInfo -eq $null) if($UserInfo -eq $null)
@ -385,13 +412,15 @@ Function main()
$Licenses=$UserInfo.Licenses.AccountSkuID $Licenses=$UserInfo.Licenses.AccountSkuID
Write-Host Removing $Licenses license from $Identity Write-Host Removing $Licenses license from $Identity
Set-MsolUserLicense -UserPrincipalName $Identity -RemoveLicenses $Licenses Set-MsolUserLicense -UserPrincipalName $Identity -RemoveLicenses $Licenses
Write-Host Action completed -ForegroundColor Green Write-Host `nAction completed -ForegroundColor Green
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
} }
9 { 9 {
$OutputCSVName="./Office365LicenseRemoval_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt" $OutputCSVName="./Office365LicenseRemoval_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt"
$UserNamesFile=Read-Host "Enter the CSV file containing user names(Eg:D:/UserNames.csv)" $UserNamesFile=Read-Host "`nEnter the CSV file containing user names(Eg:D:/UserNames.csv)"
#We have an input file, read it into memory #We have an input file, read it into memory
$UserNames=@() $UserNames=@()
@ -411,9 +440,9 @@ Function main()
10 { 10 {
$OutputCSVName="./O365LicenseRemoval_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt" $OutputCSVName="./O365LicenseRemoval_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt"
$License=Read-Host "Enter the license name(Eg:TenantName:LicensePlan)" $License=Read-Host "`nEnter the license name(Eg:TenantName:LicensePlan)"
$ProcessedCount=0 $ProcessedCount=0
Write-Host Removing $License license from users... Write-Host `nRemoving $License license from users...`n
if((Get-MsolAccountSku).AccountSkuID -icontains $License) if((Get-MsolAccountSku).AccountSkuID -icontains $License)
{ {
Get-MsolUser -All | Where-Object {($_.licenses).AccountSkuId -eq $License} | foreach{ Get-MsolUser -All | Where-Object {($_.licenses).AccountSkuId -eq $License} | foreach{
@ -432,7 +461,7 @@ Function main()
11 { 11 {
$OutputCSVName="./O365LicenseRemoval_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt" $OutputCSVName="./O365LicenseRemoval_Log__$((Get-Date -format yyyy-MMM-dd-ddd` hh-mm` tt).ToString()).txt"
Write-Host Removing license from disabled users... Write-Host `nRemoving license from disabled users...`n
$ProcessedCount=0 $ProcessedCount=0
Get-MsolUser -All -EnabledFilter DisabledOnly | where {$_.IsLicensed -eq $true} | foreach { Get-MsolUser -All -EnabledFilter DisabledOnly | where {$_.IsLicensed -eq $true} | foreach {
$ProcessedCount++ $ProcessedCount++
@ -458,11 +487,4 @@ Function main()
While ($GetAction -ne 0) While ($GetAction -ne 0)
Clear-Host Clear-Host
} }
. main . main
<#
=============================================================================================
Name: Office 365 license reporting and management using PowerShell
For detailed Script execution: https://o365reports.com/2021/11/23/office-365-license-reporting-and-management-using-powershell
============================================================================================
#>

View File

@ -3,6 +3,18 @@
Name: Remove email forwarding in Office 365 Name: Remove email forwarding in Office 365
Version: 1.0 Version: 1.0
Website: m365scripts.com Website: m365scripts.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script uses modern authentication to connect to Exchange Online.
2.The script can be executed withMFA enabled account too.
3.Exports the report result toa CSV file.
4.Removes email forwarding configurations as well as disables the inbox rule with email forwarding.
5.Removes forwarding from a specific user.
6.Disables email forwarding for a list of users through input CSV.
7.Automatically installs the EXO V2 module (if not installed already) upon your confirmation.
8.Credentials are passed as parameters (scheduler-friendly).
For detailed script execution: https://m365scripts.com/exchange-online/remove-email-forwarding-in-office-365-using-powershell/ For detailed script execution: https://m365scripts.com/exchange-online/remove-email-forwarding-in-office-365-using-powershell/
============================================================================================ ============================================================================================
#> #>
@ -167,7 +179,7 @@ if (((Test-Path -Path $global:ExportCSVFileName1) -ne "True") -and ((Test-Path -
else { else {
if ((Test-Path -Path $global:ExportCSVFileName1) -eq "True") { if ((Test-Path -Path $global:ExportCSVFileName1) -eq "True") {
if ((Test-Path -Path $global:ExportCSVFileName2) -eq "True") { if ((Test-Path -Path $global:ExportCSVFileName2) -eq "True") {
Write-Host "Following output files are generated and avaialble in the current directory" -ForegroundColor green Write-Host `n "Following output files are generated and avaialble in the current directory:" -NoNewline -ForegroundColor Yellow; Write-Host "$OutputCsv2"`n
Write-Host "$global:ExportCSVFileName1 , $global:ExportCSVFileName2" -ForegroundColor Cyan Write-Host "$global:ExportCSVFileName1 , $global:ExportCSVFileName2" -ForegroundColor Cyan
Write-Host "The log file available in $global:logfile" -ForegroundColor Green Write-Host "The log file available in $global:logfile" -ForegroundColor Green
$prompt = New-Object -ComObject wscript.shell $prompt = New-Object -ComObject wscript.shell
@ -179,18 +191,20 @@ else {
} }
} }
else { else {
Write-Host "The output file $global:ExportCSVFileName1 is available in the current directory" -ForegroundColor Green Write-Host `n "The Output file available in: " -NoNewline -ForegroundColor Yellow; Write-Host "$global:ExportCSVFileName1"
Write-Host "The log file available in $global:logfile" -ForegroundColor Green Write-Host `n "The log file available in: " -NoNewline -ForegroundColor Yellow; Write-Host "$global:logfile"
$prompt = New-Object -ComObject wscript.shell $prompt = New-Object -ComObject wscript.shell
$userInput = $prompt.popup("Do you want to open output files?", 0, "Open Output File", 4) $userInput = $prompt.popup("Do you want to open output files?", 0, "Open Output File", 4)
if ($userInput -eq 6) { if ($userInput -eq 6) {
Invoke-Item "$global:ExportCSVFileName1" Invoke-Item "$global:ExportCSVFileName1"
Invoke-Item "$global:logfile" Invoke-Item "$global:logfile"
} }
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
} }
else { else {
Write-Host "The output file $global:ExportCSVFileName2 is available in the current directory" -ForegroundColor Green Write-Host `n "The output file $global:ExportCSVFileName2 is available in the current directory:" -NoNewline -ForegroundColor Yellow; Write-Host "$OutputCsv2"`n
if ((Test-Path -Path $global:logfile) -eq "True") { if ((Test-Path -Path $global:logfile) -eq "True") {
Write-Host "The log file available in $global:logfile" -ForegroundColor Green Write-Host "The log file available in $global:logfile" -ForegroundColor Green
$prompt = New-Object -ComObject wscript.shell $prompt = New-Object -ComObject wscript.shell
@ -206,6 +220,8 @@ else {
if ($userInput -eq 6) { if ($userInput -eq 6) {
Invoke-Item "$global:ExportCSVFileName2" Invoke-Item "$global:ExportCSVFileName2"
} }
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
} }
} }

View File

@ -5,6 +5,16 @@ Description: This script exports SharePoint Online external user file access
Version: 1.0 Version: 1.0
Website: o365reports.com Website: o365reports.com
Script by: O365Reports Team Script by: O365Reports Team
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script uses modern authentication to connect to Exchange Online.
2.The script can be executed with MFA enabled account too.
3.Exports report results to CSV file.
4.Allows you to generate an external file access report for a custom period.
5.Automatically installs the EXO V2 module (if not installed already) upon your confirmation.
6.The script is scheduler friendly. I.e., Credential can be passed as a parameter instead of saving inside the script.
For detailed script execution: https://o365reports.com/2021/03/23/audit-external-user-file-access-in-sharepoint-online-using-powershell For detailed script execution: https://o365reports.com/2021/03/23/audit-external-user-file-access-in-sharepoint-online-using-powershell
============================================================================================ ============================================================================================
#> #>
@ -213,7 +223,10 @@ else
Write-Host `nThe output file contains $AggregateResultCount audit records Write-Host `nThe output file contains $AggregateResultCount audit records
if((Test-Path -Path $OutputCSV) -eq "True") if((Test-Path -Path $OutputCSV) -eq "True")
{ {
Write-Host `nThe Output file availble in $OutputCSV -ForegroundColor Green Write-Host `n The Output file availble in: -NoNewline -ForegroundColor Yellow
Write-Host $OutputCSV
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)

View File

@ -3,7 +3,17 @@
Name: Export all shared mailboxes in Office 365 Name: Export all shared mailboxes in Office 365
Version: 1.0 Version: 1.0
Website: o365reports.com Website: o365reports.com
Script by: O365Reports Team
Script Highlights:
~~~~~~~~~~~~~~~~~
1.The script uses modern authentication to connect to Exchange Online.
2.The script can be executed with an MFA-enabled account too.
3.Exports report results to CSV file.
4.It helps to identify shared mailboxes with licenses separately.
5.Helps to track email forwarding configured shared mailboxes.
6.Automatically installs the EXO V2 module (if not installed already) upon your confirmation.
7.The script is scheduler-friendly. I.e., Credentials can be passed as a parameter instead of getting interactively.
For detailed script execution: https://o365reports.com/2022/07/13/get-shared-mailbox-in-office-365-using-powershell For detailed script execution: https://o365reports.com/2022/07/13/get-shared-mailbox-in-office-365-using-powershell
============================================================================================ ============================================================================================
#>Param #>Param
@ -113,14 +123,16 @@ else
Write-Host `nThe output file contains $OutputCount shared mailboxes. Write-Host `nThe output file contains $OutputCount shared mailboxes.
if((Test-Path -Path $OutputCSV) -eq "True") if((Test-Path -Path $OutputCSV) -eq "True")
{ {
Write-Host `nThe Output file available in $OutputCSV -ForegroundColor Green Write-Host `n "The Output file available in:" -NoNewline -ForegroundColor Yellow; Write-Host "$OutputCSV"`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` $UserInput = $Prompt.popup("Do you want to open output file?",`
0,"Open Output File",4) 0,"Open Output File",4)
If ($UserInput -eq 6) If ($UserInput -eq 6)
{ {
Invoke-Item "$OutputCSV" Invoke-Item "$OutputCSV"
} }
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
} }
} }