Forum Discussion
Unable to run Export-MsIdAzureMfaReport getting error please advise
Unable to run Export-MsIdAzureMfaReport .\report.xlsx getting errors
PowerShell 7.4.4
PS C:\Windows\System32> Connect-MgGraph -Scopes Directory.Read.All, AuditLog.Read.All, UserAuthenticationMethod.Read.All
Welcome to Microsoft Graph!
Connected via delegated access using ******************************
NOTE: You can use the -NoWelcome parameter to suppress this message.
PS C:\Windows\System32> Export-MsIdAzureMfaReport .\Temp\report.xlsx
Compare-Object: Cannot bind argument to parameter 'DifferenceObject' because it is null.
Compare-Object: Cannot bind argument to parameter 'DifferenceObject' because it is null.
Write-Error: Unable to find target address
PS C:\Windows\System32>
Please help! Thanks.
3 Replies
- justmithunCopper Contributor
Please check the path you are pointing to exists for the export, then run the command againLearner2023
- LainRobertsonSilver Contributor
Hi, Haroon.
From reading the source code on git, it appears the failure is occurring within the Test-MgModulePrerequisites function, where the results from Get-MgContext are used.
What output do you get - if any - if you run the following cmdlet in lieu of the Export-MsIdAzureMfaReport cmdlet?
(Get-MgContext).Scopes;Cheers,
Lain
- Run it in VSCode, check what line uses Compare-Object, and see how the variable referenced by DifferenceObject is filled. But first, run the script with the -Verbose parameter to see what's happening.