MSIdentityTools icon indicating copy to clipboard operation
MSIdentityTools copied to clipboard

The property 'State' cannot be found on this object. Verify that the property exists.

Open ratson31 opened this issue 1 year ago • 3 comments

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

**

ratson31 avatar Feb 06 '24 19:02 ratson31

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.

TheJenious0917 avatar Feb 10 '24 00:02 TheJenious0917

For me the error was also present in Pwsh Core

https://github.com/AzureAD/MSIdentityTools/issues/44

ddonders avatar Feb 20 '24 10:02 ddonders

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.

bchnkr avatar Feb 24 '24 11:02 bchnkr

Cheers. Thanks for testing and confirming.

merill avatar Jul 18 '24 05:07 merill