Hideous powershell and bash scripts for comparing groups

I apparently started writing this post many moons ago. I have no idea what I was doing, but maybe someone will find it useful.

$Groups = Get-ADGroup -Properties * -Filter * -SearchBase 
"OU=Groups,OU=SciComp,DC=hhmi,DC=org" 
Foreach($G In $Groups)
{
 New-Item U:\Documents\adgroups\$G.Name -type file
 Add-Content U:\Documents\adgroups\$G.Name $G.Members
}
for i in `ls`; do mv $i `echo $i | awk -F, '{print $1}' | awk -F= '{print $2}'`; done

for i in `ls`; do cat $i | awk -F, ‘{print $1}’ | awk -F= ‘{print $2}’ > mod/$i; done

mv mov/* .

for i in `ls adgroups`; do /root/grouptest.sh $i 2>/dev/null | sort > ldapgroups/$i; done
Advertisements

About kcarlile
Twitter: @overclockdlemon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: