Parity123
asked on
Powershell script modification assistance
Hello,
I have the following script:
Get-AdfineGrainedPasswordP olicy -Filter * | select Name, MinPasswordLength,LockoutD uration,ms ds-psoappl iesto
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
I have the following script:
Get-AdfineGrainedPasswordP
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
you might need to iterate it with a foreach {} construct, building your object/output with each iteration.
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 {}?
ASKER
I tried this and it does not return anything for psoappliesto
Get-AdfineGrainedPasswordP olicy -Filter * | select Name, MinPasswordLength,LockoutD uration,@{ N="Applies To";E={$_.psoappliesto}}
Get-AdfineGrainedPasswordP
You should click on the Request Attention link. You need the help of an expert that has access to an AD system.
ASKER
The following works:
Get-AdfineGrainedPasswordP olicy -Filter * | select Name, MinPasswordLength,LockoutD uration,@{ 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.
Get-AdfineGrainedPasswordP
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-AdfineGrainedPasswordP olicy -Filter * | foreach { foreach($item in $_.appliesto) { do something here with $item } }
Basically you are iterating over the AppliesTo property in each PasswordPolicy.
Get-AdfineGrainedPasswordP
Basically you are iterating over the AppliesTo property in each PasswordPolicy.
ASKER
The following works
$results = Get-AdfineGrainedPasswordP olicy -Filter *
foreach($item in $results) { do something here with $item }
$results = Get-AdfineGrainedPasswordP
foreach($item in $results) { do something here with $item }
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.