# 2003 DC Access with Quest First Script

**URL:** <https://forums.powershell.org/t/2003-dc-access-with-quest-first-script/1103>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/2003-dc-access-with-quest-first-script/1103 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/2003-dc-access-with-quest-first-script/1103/1 "2011-12-31T18:30:00Z")

</div>

by i255d at 2013-03-05 14:20:27

> I am trying the Quest AD tools for the first time. I wrote my first script and I want to see how I can make it better.  
>   
> `$CitrixGroups = Get-QADGroup -Name Citrix* | Select -Property Name | ForEach-Object {Add-Content -Path "U:\My Documents\Scirpts\Usernames.txt" -Value "" Add-Content -Path "U:\My Documents\Scirpts\Usernames.txt" -Value $.name $Users = Get-QADUser -MemberOf $.name Add-Content -Path "U:\My Documents\Scirpts\Usernames.txt" -Value "" Add-Content -Path "U:\My Documents\Scirpts\Usernames.txt" -Value $Users.SamAccountName }`  
>   
> Let me have it…  
> This gave me a text document with the name of the group and then the user ID’s in that group, with a little spacing. Maybe we can make this into a tool…?

by coderaven at 2013-03-06 17:15:01

> See this post, is it something like what you are looking for? It seems to me you are wanting to expand the members of a group and save it to file.

by DexterPOSH at 2013-03-07 19:27:06

> Hi,  
>   
> Just wanted to share that Get-QADGroupMember cmdlet can also be used to get all the User accounts in a group.  
> This can be of relevance to improve the code in future :  
> `Get-QADGroupMember -identity CitriXGroup -Indirect | where {$.type -match "user"}`

_by i255d at 2013-03-11 17:44:53_

_> Thanks, but this assumes you know the group. My script if looking for all the groups with the Citrix at the begining. I have not had a chance to play with yours yet.   
> I am stilll looking for ways to do my script better???  
> Thanks again…_

_by SalvaG at 2013-03-11 23:43:21_

> _Hi,  
> perhaps this code will help you_  
>   
> _`Get-QADGroup -Identity Citrix*| % {write-host "Group: $`_`"; Get-QADGroupMember -Identity $_ -Indirect -Type user;Write-host ""}`

by DexterPOSH at 2013-03-12 01:18:35

> [quote="SalvaG"]  
> `Get-QADGroup -Identity Citrix*| % {write-host "Group: $"; Get-QADGroupMember -Identity $ -Indirect -Type user;Write-host ""}`[/quote]  
>   
> I just wanted to show that Get-QADGroupMember can be used to get the members of the group; You can always pipeline the output from Get-QADGroup to get the groups and then recursively get the members just like in the above code…

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:58pm UTC](https://forums.powershell.org/t/2003-dc-access-with-quest-first-script/1103/2 "2024-05-16T20:58:35Z")

</div>

Closed on May 16, 2024, 8:58pm UTC


