Parity123
asked on
Powershell : Group info
Hello Experts,
I need to output sidHistory values for the group along with ManagedBy. There are multiple SIDHistory Values in some groups, so I need to output all the values for that group. I have the script below, which only outputs 1 SIDHistory Value.
$MyTempGroups = gc ./groups.txt
$result = @()
foreach($group in $MyTempGroups) {
$x = get-adgroup $group -properties sidhistory, ManagedBy, | select ManagedBy, sidHistory
$result += $x.ManagedBy + ";" + $x.sidHistory
}
$result | out-file ./results.txt
Your assistance is appreciated.
I need to output sidHistory values for the group along with ManagedBy. There are multiple SIDHistory Values in some groups, so I need to output all the values for that group. I have the script below, which only outputs 1 SIDHistory Value.
$MyTempGroups = gc ./groups.txt
$result = @()
foreach($group in $MyTempGroups) {
$x = get-adgroup $group -properties sidhistory, ManagedBy, | select ManagedBy, sidHistory
$result += $x.ManagedBy + ";" + $x.sidHistory
}
$result | out-file ./results.txt
Your assistance is appreciated.
ASKER
The output needs to be as follows:
GroupName; ManagedBy; sid1,sid2
Thanks.
GroupName; ManagedBy; sid1,sid2
Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
But your script doesn't make much sense to me as is. You are concatenating all data, not including the respective group.
What is your actual expected result if using multiple groups and having done more than one domain migration for the group objects? Can you show a short example output?