Formating Script Output
$totalobj = @() $aagrps = get-qadgroup -name "aa_*" foreach ($aagrp in $aagrps) { $grpmbrs = get-qadgroupmember -id $aagrp $totalobj += $aagrp.name foreach ($grpmbr in $grpmbrs) { $totalobj += ($grpmbr.name,$grpmbr.samaccountname) } } $totalobj | out-file testing1234.txtwhat doing here getting groups begin aa_ , members name , sam account name.
output txt file ends looking this...
aa_group1
john smith
jsmith
jane doe
jdoe
aa_group2
marilyn monroe
mmonroe
britney spears
bspearsi more readable or similar, reviewed management. suggestions?
aa_group1
john smith, jsmith
jane doe, jdoe
aa_group2
marilyn monroe, mmonroe
britney spears, bspears
thanks!!
-nerdycrook
add line in array:
$totalobj = @() $aagrps = get-qadgroup -name "aa_*" foreach ($aagrp in $aagrps) { $grpmbrs = get-qadgroupmember -id $aagrp $totalobj += $aagrp.name $totalobj += ( '=' * ($aagrp.name).length) foreach ($grpmbr in $grpmbrs) { $totalobj += ($grpmbr.name,$grpmbr.samaccountname) } } $totalobj | out-file testing1234.txt
grant ward, a.k.a. bigteddy
Windows Server > Windows PowerShell
Comments
Post a Comment