none
Get-ADgroupmember RRS feed

  • Question

  • Hey Guys,

    I am trying to acquire the members within a group as well as their grouptype or objectclass. The problem i am running into is that for each user i want to indicate if its a user or group, Ex. group:Domain Users. I am only able to retrieve either the user or the group class. Here is the query i have created please let me know if there is a better way to retrieve the data.

    i need to add the objectclass or grouptype to the same column where members are retrieve by : , any help is appreciated.

    Import-Module ActiveDirectory

    $ADUserParams=@{
    'Server' = 'blah.com'
    'Searchbase' = 'DC=blah,DC=com'
    'Searchscope'= 'subtree'
    'Filter' = '*'
    'Properties' = '*'
    }

    $SelectParams=@{

    'Property' = `
    @{n=’Fully Qualified Name’; e= { ( $_.NetBIOSname | % { (Get-ADDomain).NetBiosname }) + '\' + ($_.Name)}},`
    @{name='Notes';expression={$_.Info -join ','}},`
    @{name='Description';expression={$_.Description -join ','}},`
    @{name='Active Directory Path';expression={$_.CanonicalName -join ','}},`
    @{name=’Group Members <LIST>’; expression={$_ | Foreach {Get-ADGroupMember -Identity $_ |Select -ExpandProperty sAMAccountname| Out-String}}},`
    @{name='QueryRunDateTime';expression={Get-Date -Format G}}
    }

    Get-ADGROUP @ADUserParams | Select-Object @SelectParams | Out-GridView



    • Edited by GotUagain Friday, November 11, 2016 9:07 PM edit
    Friday, November 11, 2016 9:06 PM

Answers