help with output of my member of list from Active directory

This topic contains 11 replies, has 5 voices, and was last updated by Profile photo of Jeff Adair Jeff Adair 3 years, 8 months ago.

  • Author
    Posts
  • #10694
    Profile photo of Jeff Adair
    Jeff Adair
    Participant

    im pretty new to PS and i need help with getting a list from the member of tab in active directory for my user names. I log into server 2008 and then open Active diretory and alos powershell on the same server. when i launch powershell what do i need to get the List of member of for my username? what are the commands. thanks

  • #10695
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Windows Server 2008 doesn't come with any built-in Active Directory commands, so you would need to use the [adsi] provider, which is quite a bit more complicated. 2008R2 comes with AD commands.

    You can also install the AD commands on Win7 or Win8 by installing the RSAT. It's recommended that you do that, instead of logging on to your DC directly. The AD commands can talk to any DC Win2003 or later – although on Win2003 and Win2008, you have to install the free AD Management Gateway on at least one DC. Both the Gateway and the RSAT can be downloaded from Microsoft.

  • #10696
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Oh, and from there you'd run something like

    Get-ADUser -Identity MyUserName -Prop * | Select *

    To see the MemberOf property. But this does only show direct memberships, like the tab in ADUC; it won't show nested memberships.

  • #10697
    Profile photo of Jeff Adair
    Jeff Adair
    Participant

    I wanted to use Powershell on teh server itself becuase i dont have Windows 7 i have windows xp and i can not install Admin tools pack, i had admin tools pack previously but laptop crashed now not allowed to install it. there has to be someway when im logged into this domain server with powershell via RDP to run some commands in PS to get the output of memberof for my username. thanks

  • #10699
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Windows Server 2008 does not contain PowerShell commands for Active Directory.

    You might look at http://technet.microsoft.com/en-us/magazine/2007.06.powershell.aspx, which discusses using PowerShell with older versions of Windows. It's basically like writing VBScript.

  • #10701
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    If you're only interested in your own group memberships, you could just run "whoami /groups" at a command prompt or PowerShell console.

  • #10704
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    For Windows 2008 the other option is to download the free Quest cmdlets
    http://www.quest.com/powershell/activeroles-server.aspx

  • #10705
    Profile photo of Jeff Adair
    Jeff Adair
    Participant

    Windows Server 2008 does not contain PowerShell commands for Active Directory. hmm that is not true i launched PS and used this command to connect to AD im logged into the remote server with PS installed on it.

    PS C:\Users\nbetzfw> Import-Module Active Directory – ran this
    then ran this

    PS C:\Users\nbetzfw> Get-ADUser nbktzfw -Properties MemberOf | Select-Object -ExpandProperty MemberOf

    worked like a charm

  • #10706
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    You must be running Server 2008 R2, then. That's the earliest server OS that supports the AD module.

  • #10707
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    It sounds like someone has already installed the gateway & cmdlets that Don mentioned

  • #10715
    Profile photo of notarat
    notarat
    Participant

    [quote=0]im pretty new to PS and i need help with getting a list from the member of tab in active directory for my user names. I log into server 2008 and then open Active diretory and alos powershell on the same server. when i launch powershell what do i need to get the List of member of for my username? what are the commands. thanks[/quote]

    Here's a script that shows nested group membership for a user-supplied account.

    $usr=Read-Host "Enter User.Name to Query: "
    $grps=(dsquery user -name $usr | dsget user -memberof -expand)
    foreach($grp in $grps) {
        $strGRP=($grp | Sort Name | foreach {($_.Split(','))[0]}) -Join ","
        $strDONE=$strGRP
        write-host $strDone
    }
    
  • #10717
    Profile photo of Jeff Adair
    Jeff Adair
    Participant

    Thanks Guys!!!

You must be logged in to reply to this topic.