output to csv displaying AD group names and total members


so i'm trying write script parse text file containing group names , each 1 count members -

i've got work lists numbers on screen. need output csv column showing group names , column b showing numbers:

import-module activedirectory

$a = get-content "e:\scripts\spgroups.txt"

foreach ($i in $a) {

(get-adgroup $i -properties *).member.count

}

can help? i've been experimenting export-csv grouptotals.csv - can't work yet

thanks

j

 

get-adgroup groupname -properties member | select name, @{n='count';e={$_.member.count}}


¯\_(ツ)_/¯



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Round Robin is killing performance on our network

WMI Repository 4GB limit - Win 2003 Ent Question

Change home folder default permission?