determining group membership from a bulk list of groups.

by IrritatedLlama at 2012-12-20 09:17:43

Greetings Powershell.org Community! Glad I found you. I will be lurking around and posting where I can. Right now, I have something of an urgent issue…

I am trying to get the groove of Powershell, I am still a noob with it though. I am having an issue with this little commandlet I wrote and I was hoping you point me in the right direction…

get-content -path c:\Output\ProdSwanFQDN.txt| % {Get-QADGroupMember} | select SamAccountName,displayname,first,last,email| ft -AutoSize > c]

Which gives me the prompt:

cmdlet Get-QADGroupMember at command pipeline position 1
Supply values for the following parameters:
Identity:


Of course, I don’t know what it wants. I have a list of the SamAccountNames for the groups and a path to them in a csv at the specified location… It is formatted like this:

MyDoman.net/path/path/Accounts/SecurityGroups/GroupName

I am using the Quest version of powershell… Don’t know if that makes a difference to this community. I will be feverishly monitoring this thread, so let me know if you need more info. I will also post the solution in the unlikely event that I figure it out…

Thanks in advance!
by IrritatedLlama at 2012-12-20 10:10:17
Here… It’s dangerous to go alone… Take this…

$csv = Get-Content "c:\Output\GroupMembership.txt"

$result = $csv | foreach-object {
$group=$
get-qadgroupmember "$
" -sizelimit 0 -indirect | select-object samaccountname,@{n="GroupName";e={$group}}
}
$result | export-csv c:\Output\GRP-Result.txt


This ran like a charm. The output is a bit muddy, but I will deal with that. As I always like to credit brilliance to its origin… I found it here: http://stackoverflow.com/questions/9282 … ort-to-csv