Author Posts

October 11, 2013 at 8:44 am

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

October 11, 2013 at 8:47 am

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.

October 11, 2013 at 8:54 am

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.

October 11, 2013 at 9:25 am

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

October 11, 2013 at 9:54 am

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.

October 11, 2013 at 9:59 am

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

October 11, 2013 at 10:22 am

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

October 11, 2013 at 10:23 am

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

October 11, 2013 at 10:25 am

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

October 11, 2013 at 10:26 am

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

October 11, 2013 at 11:53 am

[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
}