From 4dc996b2fb02aa90effafb98b735a9c7c35e5caa Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Mon, 17 Jun 2024 11:09:04 -0500 Subject: [PATCH] Fix: MFA STATUS Function --- source/Public/Get-MFAStatus.ps1 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/Public/Get-MFAStatus.ps1 b/source/Public/Get-MFAStatus.ps1 index b936e71..53f6112 100644 --- a/source/Public/Get-MFAStatus.ps1 +++ b/source/Public/Get-MFAStatus.ps1 @@ -44,7 +44,7 @@ function Get-MFAStatus { process { if (Get-Module MSOnline){ Connect-MsolService - Write-Host -Object "Finding Azure Active Directory Accounts..." + Write-Host "Finding Azure Active Directory Accounts..." # Get all users, excluding guests $Users = if ($PSBoundParameters.ContainsKey('UserId')) { Get-MsolUser -UserPrincipalName $UserId @@ -52,7 +52,7 @@ function Get-MFAStatus { Get-MsolUser -All | Where-Object { $_.UserType -ne "Guest" } } $Report = [System.Collections.Generic.List[Object]]::new() # Create output list - Write-Host -Object "Processing" $Users.Count "accounts..." + Write-Host "Processing $($Users.Count) accounts..." ForEach ($User in $Users) { $MFADefaultMethod = ($User.StrongAuthenticationMethods | Where-Object { $_.IsDefault -eq "True" }).MethodType $MFAPhoneNumber = $User.StrongAuthenticationUserDetails.PhoneNumber @@ -92,12 +92,11 @@ function Get-MFAStatus { $Report.Add($ReportLine) } - Write-Host -Object "Processing complete." + Write-Host "Processing complete." return $Report | Select-Object UserPrincipalName, DisplayName, MFAState, MFADefaultMethod, MFAPhoneNumber, PrimarySMTP, Aliases | Sort-Object UserPrincipalName } else { - Write-Host -Object "You must first install MSOL using:`nInstall-Module MSOnline -Scope CurrentUser -Force" + Write-Host "You must first install MSOL using:`nInstall-Module MSOnline -Scope CurrentUser -Force" } } - -} \ No newline at end of file +}