• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1094
  • Last Modified:

Get-qadgroup from a list of files which has groups

I have an input file with 10 groups.

Need to import the input file and get the below command.

Qet-Qadgroup -id $_ | get-qadgroupmember -indirect -includeallproperties | select samaccountname,useraccountcontrol.

Just need the syntax of how to import a group and get the required output.

Is there any similar command in windows powershell  to accept group of users and get the nested group members name with useraccountcontrol.
0
AhmedAliShaik
Asked:
AhmedAliShaik
  • 5
  • 3
  • 2
2 Solutions
 
Krzysztof PytkoSenior Active Directory EngineerCommented:
If it is flat text file then use
Get-Content c:\groups.txt | %{ Get-QADgroup -id $_ | Get-QADGroupMember -Indirect -Includeallproperties | select samaccountname,useraccountcontrol }

Open in new window


or for CSV file
Import-CSV c:\groups.csv | %{ Get-QADgroup -id $_."groupName" | Get-QADGroupMember -Indirect -Includeallproperties | select samaccountname,useraccountcontrol }

Open in new window


Regards,
Krzysztof
0
 
AhmedAliShaikAuthor Commented:
Hi Krzysztof,

After a long time . Good to meet u here virtually.

Will try the command and post you.

Do  we have the equivalent windows powershell script, as i have a script to pull local admintrator users from a list of computers in windows powershell, i can club both the commands as per requirement.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Could you elaborate more, best with an example, about what you expect to do and get?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
AhmedAliShaikAuthor Commented:
As the quest command is giving the nested members with samaccountname & useraccountcontrol from the input groups.

Can we get the same output from Windows Powershell script.

Kindly let you know if u need more clarification.
0
 
Krzysztof PytkoSenior Active Directory EngineerCommented:
Hi Ahmed :)

if you mean Windows PowerShell module for AD, yes it is also possible using Get-ADUser cmd-let

If you wish to use regular PowerShell v1.0 or 2.0, you need to use some other queries like ADSI but I have no experience with that, so you need to wait for other experts (i.e Qlemo)

Krzysztof
0
 
AhmedAliShaikAuthor Commented:
Thanks a lot Krzysztof.

I will wait for Qlemo's response.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
It's more difficult than that - Get-ADUser is available with RSAT, requiring W2008R2 and the AD Web Services. So we are bound to use LDAP queries (ADSI) here, and that's a much different beast, one I'm not able to tame at the moment.
I'll might come back, but I would not count on it.

Being a Topic Advisor, I could set this question to neglected to get the attention of more Experts, but doubt that there will be any because of the title. I recommend to accept the answer of Krzysztof (maybe with 250 points instead of 500), and ask a new question (referring to this one) for how to do that without the Quest cmdlets.
0
 
AhmedAliShaikAuthor Commented:
Thanks for your reply.

I ask a new question referring the case.
0
 
AhmedAliShaikAuthor Commented:
Thanks.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
I did not expect to get points for that, but they are welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now