2003 DC Access with Quest First Script

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 6 years, 5 months ago.

  • Author
  • #6048

    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


    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

    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

    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..

You must be logged in to reply to this topic.