Error thrown when executing Export-MsIdAppConsentGrantReport after the module update.
Hi @merill ,
When I execute the below command after updating the module, I get this error:
PS C:\WINDOWS\system32> Update-Module -Name MSIdentityTools -Force
PS C:\WINDOWS\system32> Import-Module MSIdentityTools -Force
WARNING: It is recommended to use this module with the latest version of PowerShell which can be downloaded here: https://aka.ms/install-powershell
PS C:\WINDOWS\system32> Export-MsIdAppConsentGrantReport -ReportOutputType ExcelWorkbook -ExcelWorkbookPath 'C:\TEMP\report.xlsx'
ForEach-Object : Parameter set cannot be resolved using the specified named parameters.
At C:\Program Files\WindowsPowerShell\Modules\MSIdentityTools\2.0.52\MSIdentityTools.psm1:3021 char:44
+ ... rincipals | ForEach-Object -AsJob -ThrottleLimit $ThrottleLimit -Para ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [ForEach-Object], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.ForEachObjectCommand
The property 'State' cannot be found on this object. Verify that the property exists.
At C:\Program Files\WindowsPowerShell\Modules\MSIdentityTools\2.0.52\MSIdentityTools.psm1:3042 char:16
+ while ($job.State -eq 'Running') {
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], PropertyNotFoundException
+ FullyQualifiedErrorId : PropertyNotFoundStrict
Is this intentional or something that can be fixed?
Thank you.
I had this issue and realised that I had to run this using version 7 of PowerShell, and not version 5. Worked once I switched.
I have the same issue, the warning is shown when the module is loaded, I believe:
$PSVersionTable
Name Value
PSVersion 5.1.22621.2506
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2506
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Get-Module MSIdentityTools -ListAvailable
Script 2.0.52 MSIdentityTools
Get-Module Microsoft.Graph -ListAvailable
Manifest 2.1.0 Microsoft.Graph
Get-Module ImportExcel -ListAvailable
Script 7.8.6 ImportExcel
Export-MsIdAppConsentGrantReport -ReportOutputType PowerShellObjects
ForEach-Object : Parameter set cannot be resolved using the specified named parameters. The property 'State' cannot be found on this object. Verify that the property exists.
Export-MsIdAppConsentGrantReport -ReportOutputType ExcelWorkbook -ExcelWorkbookPath [Path]
WARNING: It is recommended to use this module with the latest version of PowerShell which can be downloaded here: https://aka.ms/install-powershell ForEach-Object : Parameter set cannot be resolved using the specified named parameters. The property 'State' cannot be found on this object. Verify that the property exists.
As noted above by @ThatM365Guy, the ForEach-Object -AsJob -ThrottleLimit $ThrottleLimit -Parallel construct used in the GetDelegatePermissions function requires PowerShell version 7. Is this the only portion of Export-MsIdAppConsentGrantReport that requires version 7? If so, it would be great if there could be a PS 5.1 compatible version (realizing it could severely impact performance).
Yeah this is the only one that requires v7.