The property 'State' cannot be found on this object. Verify that the property exists.
I receive the following when running the script. The script then stops running. It produces part of the Excel sheet only.
Please advise if there is something I need to do at my end to resolve this.
**
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
**
fyi @ratson31, I ran into the same issue when I was running this in Powershell 5.1. When I ran this on the current version of Pwsh 7, this error went away and the rest of the script completed (it was dying out at the error you mention and not finishing the export).
I briefly saw a warning message that popped up when I first ran it in 5.1 that suggests to run the script in core versions of pwsh, so I would guess this type of thing is why.
For me the error was also present in Pwsh Core
https://github.com/AzureAD/MSIdentityTools/issues/44
Same here, ran into the issue when running this in Powershell 5.1.
The current build is 2.0.52.
The internal function GetDelegatePermissions was changed pretty much from previous version.
Just changed the code-block (that specific function only) back to release 2.0.51.
Problem is solved so far. The generated Excel-Report contains a lot more informations.
Cheers. Thanks for testing and confirming.