Link to home
Start Free TrialLog in
Avatar of Parity123
Parity123Flag for United States of America

asked on

Powershell script modification assistance

Hello,

I have the following script:

Get-AdfineGrainedPasswordPolicy -Filter * | select Name, MinPasswordLength,LockoutDuration,msds-psoappliesto

I am not getting any values returned for msds-psoappliesto. It is a multivalued attribute. It contains a list of group/user DN's

How would I go about retrieving values for this multivalued attribute.

Thanks
Avatar of aikimark
aikimark
Flag of United States of America image

you might need to iterate it with a foreach {} construct, building your object/output with each iteration.
Avatar of Parity123

ASKER

Could you please give me an example. Thanks.
I'm not on an AD system, so I can't test any code.  Are you familiar with foreach {}?
I tried this and it does not return anything for psoappliesto

Get-AdfineGrainedPasswordPolicy -Filter * | select Name, MinPasswordLength,LockoutDuration,@{N="Applies To";E={$_.psoappliesto}}
You should click on the Request Attention link.  You need the help of an expert that has access to an AD system.
The following works:


Get-AdfineGrainedPasswordPolicy -Filter * | select Name, MinPasswordLength,LockoutDuration,@{N="Applies To";E={$_.appliesto -join ";"}}

Now I need to get individual element from "AppliesTo", check if it is a group, and if it is a group check managedby properties.
That is where iteration and filtering would happen
Could you try this:

Get-AdfineGrainedPasswordPolicy -Filter * | foreach { foreach($item in $_.appliesto) { do something here with $item } }

Basically you are iterating over the AppliesTo property in each PasswordPolicy.
The following works

$results = Get-AdfineGrainedPasswordPolicy -Filter *

 foreach($item in $results) { do something here with $item }
ASKER CERTIFIED SOLUTION
Avatar of DBAduck - Ben Miller
DBAduck - Ben Miller
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial