Extracting MFA User Status to CSV

March 26, 2019 | by iaur | posted as Adminstration, Microsoft 365

  • Open PowerShell ISE
  • Run the ff. cmdlets
    • Set-ExecutionPolicy Unrestricted
    • Connect-MsolService
  • Open from the same PoweShell ISE session then hit the run button
Machine generated alternative text:
Administrator: Windows PowerSheII ISE 
File Edit View Tools Debug Add-ons Help 
Tickle-MailRecipients.ps I 
28 
20 
21 
22 
25 
26 
29 
30 
33 
34 
35 
36 
37 
38 
39 
41 
42 
*Accept input parameters 
8Param( 
MandatoryæSfa1se, 
[stri ngJ SOutputFi le 
*Set default output file path if not passed. 
ValueFrompi pel i ne=Strue)] 
if (Cstri ngJ : : ISNul I e) -eq Strue) 
soutputFi1e = 
SResu1 
fusers = Get-Ms01User -All 
•Susers I ForEach-0bject { 
Suser = S 
-if (fuser. StrongAuthenticationRequirements.State -ne 
SmfaStatus = fuser. StrongAuthent1cationRequi rements.State 
Smfastatus = "Disabled" } 
- 'Result New-object PSObject -property 
UserName fuser. DisplayName 
User-principalName = fuser _ User-principalName 
PS Set-Executionpolicy Remotesigned 
PS C: 
File cannot be loaded. The file 
digitally signed. You cannot run this script on the current system _ For more information about running scripts and setting execution policy, 
about_Execution_p01icies at https:/go.microsoft.ccn/fw1ink/?LinklD—135170. 
Categorylnfo 
: Securi tyError: (:) , ParentContainsErrorRecordException 
+ Ful : UnauthorizedAccess 
PS C: Set—ExecutiMIPolicy unrestricted 
PS C: Connect-Ms01Servi ce 
PS C: C: 
Report exported successfully 
ps C: 
not 
Commands X 
Modules: Al 
Add -AP ientCon nectionGrou p 
Add Ap pvCIientPackage 
Add-AppvPubIishityServer 
Add -AP 
Add Ap porowsioned Package 
Add-Ap pxVoIume 
Add -BCDataCacheEXtension 
Add BitLockerKeyProtector 
Add-BitsFile 
Add -CertificateE O'Server 
Add -Computer 
Add -Content 
Add-DnsCIientNrptRuIe 
Add DtcCIusterTM Mappi 
Add -EtwTraceP rovider 
Add -History 
Add Maski ngSet 
Add -JobTrigger 
Add-KdsRootKey 
Add -L«aIG roupMem ber 
Add-M ember 
Add -M p Preference 
Add -M solAdm in istrativeUnitMem ber 
Add -M SOI pToRole 
Add -M solGroupMember 
Add-M RoleMember 
Add -M ROIeMember 
Add -NetEvent NetworkAda pter 
Add -NetEventPacketCaptu reprcwider 
Add NetEventVF P Provider 
Ln21 coil
  • Access the default location below
    • Windows + R
    • Type and Enter
      • %userprofile%
Machine generated alternative text:
Home 
rootv m 
Share 
rootvm 
View 
Search rootvm 
Quick access 
Desktop 
•W Downloads 
Documents 
Pictures 
HyperV 
Music 
Syste m32 
Videos 
OneDrive 
OneDrive- FacereSic 
This pc 
Network 
o 
OneDnve - 
Facere 
Sionem 
3D Objects 
Pictures 
AppData 
Saved 
Games 
Contacts 
Searches 
Desktop 
Documents 
Downl cads 
a, 
0365- users 
- mfa-statu 
Favorites 
Links 
MicrosoftE 
dge8ackup 
Music 
OneDnve 
NTUS 
D

Reference : https://gallery.technet.microsoft.com/office/Export-Office-365-Users-eed7a82c