Powershell script modification assistance


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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you might need to iterate it with a foreach {} construct, building your object/output with each iteration.
Parity123Author Commented:
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 {}?
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Parity123Author Commented:
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.
Parity123Author Commented:
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
DBAduck - Ben MillerPrincipal ConsultantCommented:
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.
Parity123Author Commented:
The following works

$results = Get-AdfineGrainedPasswordPolicy -Filter *

 foreach($item in $results) { do something here with $item }
DBAduck - Ben MillerPrincipal ConsultantCommented:
It is kind of the same thing as I was illustrating.  I was just showing you the way with the Pipeline but getting the results and then iterating them is certainly an option as well.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.