mirror of
https://github.com/admindroid-community/powershell-scripts.git
synced 2025-12-17 16:35:19 +00:00
Get Microsoft 365 Users' MFA Status
Get Microsoft 365 Users' MFA Status
This commit is contained in:
parent
14533214b8
commit
39a9ac8385
@ -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)
|
||||||
@ -214,10 +242,14 @@ 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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user