ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Server 2012: PS Get-ADGroupMember

    IT Discussion
    2012 2012 r2 windows server 2012 server 2012 r2 powershell
    7
    26
    3.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gjacobseG
      gjacobse
      last edited by

      having some difficulty with the syntax to list the members of a Server 2012 AD Security Group.

      get-adgroupmember
      

      is where I am starting, but it of course errors, and when I try

      Get-ADGropuMember "GroupName"
      

      doesn't work either.

      1 Reply Last reply Reply Quote 0
      • coliverC
        coliver
        last edited by

        What are the errors?

        1 Reply Last reply Reply Quote 0
        • coliverC
          coliver
          last edited by coliver

          Did you do

          Import-Module ActiveDirectory

          ?

          travisdh1T 1 Reply Last reply Reply Quote 0
          • gjacobseG
            gjacobse
            last edited by gjacobse

            At line:1 char:1
            + Get-ADGroupMember
            + ~~~~~~~~~~~~~~~~~
                + CategoryInfo          : ObjectNotFound: (GroupName:ADGroup) [Get-ADGroupMember], ADIdentityNotFoundException
                + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,M
               icrosoft.ActiveDirectory.Management.Commands.GetADGroupMember
            
            coliverC 1 Reply Last reply Reply Quote 0
            • coliverC
              coliver @gjacobse
              last edited by coliver

              @gjacobse said in Server 2012: PS Get-ADGroupMember:

              Get-ADGroupMember : Cannot find an object with identity: 'GroupName' under: 'DC=Domain,DC=com'.
              At line:1 char:1

              • Get-ADGroupMember
              •   + CategoryInfo          : ObjectNotFound: (GroupName:ADGroup) [Get-ADGroupMember], ADIdentityNotFoundException
                  + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,M
                 icrosoft.ActiveDirectory.Management.Commands.GetADGroupMember
                

              So that means the group doesn't exist. Can you confirm that it does.

              I just did the same command with one of our groups and it worked as expected with -

              Get-ADGroupMember "GroupName"

              gjacobseG 1 Reply Last reply Reply Quote 0
              • gjacobseG
                gjacobse @coliver
                last edited by

                @coliver said in Server 2012: PS Get-ADGroupMember:

                @gjacobse said in Server 2012: PS Get-ADGroupMember:

                Get-ADGroupMember : Cannot find an object with identity: 'GroupName' under: 'DC=Domain,DC=com'.
                At line:1 char:1

                • Get-ADGroupMember
                •   + CategoryInfo          : ObjectNotFound: (GroupName:ADGroup) [Get-ADGroupMember], ADIdentityNotFoundException
                    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,M
                   icrosoft.ActiveDirectory.Management.Commands.GetADGroupMember
                  

                So that means the group doesn't exist. Can you confirm that it does.

                I just did the same command with one of our groups and it worked as expected with -

                Get-ADGroupMember "GroupName"

                damn it-
                I did that and it errored. Copy yours and it works... (grumbles at keyboard)

                Yes, group exists

                coliverC 1 Reply Last reply Reply Quote 0
                • gjacobseG
                  gjacobse
                  last edited by

                  so Now all I need is a single line from it (Name) not the full list... is that a filter?

                  coliverC 1 Reply Last reply Reply Quote 0
                  • coliverC
                    coliver @gjacobse
                    last edited by

                    @gjacobse said in Server 2012: PS Get-ADGroupMember:

                    so Now all I need is a single line from it (Name) not the full list... is that a filter?

                    Get-AdGroupMember "GroupName" | Select-Object {$_.name}

                    1 Reply Last reply Reply Quote 1
                    • coliverC
                      coliver @gjacobse
                      last edited by

                      @gjacobse said in Server 2012: PS Get-ADGroupMember:

                      @coliver said in Server 2012: PS Get-ADGroupMember:

                      @gjacobse said in Server 2012: PS Get-ADGroupMember:

                      Get-ADGroupMember : Cannot find an object with identity: 'GroupName' under: 'DC=Domain,DC=com'.
                      At line:1 char:1

                      • Get-ADGroupMember
                      •   + CategoryInfo          : ObjectNotFound: (GroupName:ADGroup) [Get-ADGroupMember], ADIdentityNotFoundException
                          + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,M
                         icrosoft.ActiveDirectory.Management.Commands.GetADGroupMember
                        

                      So that means the group doesn't exist. Can you confirm that it does.

                      I just did the same command with one of our groups and it worked as expected with -

                      Get-ADGroupMember "GroupName"

                      damn it-
                      I did that and it errored. Copy yours and it works... (grumbles at keyboard)

                      Yes, group exists

                      Haha... tab complete is your friend.

                      1 Reply Last reply Reply Quote 1
                      • travisdh1T
                        travisdh1 @coliver
                        last edited by

                        @coliver said in Server 2012: PS Get-ADGroupMember:

                        Did you do

                        Import-Module ActiveDirectory

                        ?

                        One of my major pain-points with PowerShell. Why does every module have to be manually loaded. It's not like you have to load them into memory until it's actually needed.

                        gjacobseG coliverC dbeatoD 3 Replies Last reply Reply Quote 1
                        • gjacobseG
                          gjacobse @travisdh1
                          last edited by

                          @travisdh1 said in Server 2012: PS Get-ADGroupMember:

                          @coliver said in Server 2012: PS Get-ADGroupMember:

                          Did you do

                          Import-Module ActiveDirectory

                          ?

                          One of my major pain-points with PowerShell. Why does every module have to be manually loaded. It's not like you have to load them into memory until it's actually needed.

                          My issue with Powershell is... Well Powershell..

                          travisdh1T 1 Reply Last reply Reply Quote 0
                          • travisdh1T
                            travisdh1 @gjacobse
                            last edited by

                            @gjacobse said in Server 2012: PS Get-ADGroupMember:

                            @travisdh1 said in Server 2012: PS Get-ADGroupMember:

                            @coliver said in Server 2012: PS Get-ADGroupMember:

                            Did you do

                            Import-Module ActiveDirectory

                            ?

                            One of my major pain-points with PowerShell. Why does every module have to be manually loaded. It's not like you have to load them into memory until it's actually needed.

                            My issue with Powershell is... Well Powershell..

                            Ha! PowerShell is so close to being good. They got command completion down, and actually working with it once you get it to the point where it's helpful is normally quite good. It's the setup that really kinda sucks.

                            1 Reply Last reply Reply Quote 0
                            • gjacobseG
                              gjacobse
                              last edited by

                              Finds it

                              Get-ADGroupMember "GroupName" -recursive | select name, objectclass
                              
                              coliverC 1 Reply Last reply Reply Quote 2
                              • coliverC
                                coliver @travisdh1
                                last edited by

                                @travisdh1 said in Server 2012: PS Get-ADGroupMember:

                                @coliver said in Server 2012: PS Get-ADGroupMember:

                                Did you do

                                Import-Module ActiveDirectory

                                ?

                                One of my major pain-points with PowerShell. Why does every module have to be manually loaded. It's not like you have to load them into memory until it's actually needed.

                                The new PowerShell core seems to auto import modules when you use a command from them.

                                travisdh1T 1 Reply Last reply Reply Quote 0
                                • coliverC
                                  coliver @gjacobse
                                  last edited by

                                  @gjacobse said in Server 2012: PS Get-ADGroupMember:

                                  Finds it

                                  Get-ADGroupMember "GroupName" -recursive | select name, objectclass
                                  

                                  Glad you got it. Was the recursive flag required?

                                  gjacobseG 1 Reply Last reply Reply Quote 0
                                  • gjacobseG
                                    gjacobse @coliver
                                    last edited by

                                    @coliver said in Server 2012: PS Get-ADGroupMember:

                                    @gjacobse said in Server 2012: PS Get-ADGroupMember:

                                    Finds it

                                    Get-ADGroupMember "GroupName" -recursive | select name, objectclass
                                    

                                    Glad you got it. Was the recursive flag required?

                                    in the example I found - yes.

                                    dafyreD 1 Reply Last reply Reply Quote 0
                                    • dafyreD
                                      dafyre @gjacobse
                                      last edited by

                                      @gjacobse said in Server 2012: PS Get-ADGroupMember:

                                      @coliver said in Server 2012: PS Get-ADGroupMember:

                                      @gjacobse said in Server 2012: PS Get-ADGroupMember:

                                      Finds it

                                      Get-ADGroupMember "GroupName" -recursive | select name, objectclass
                                      

                                      Glad you got it. Was the recursive flag required?

                                      in the example I found - yes.

                                      The -recursive flag handles nested groups. This is a handy feature.

                                      1 Reply Last reply Reply Quote 1
                                      • travisdh1T
                                        travisdh1 @coliver
                                        last edited by

                                        @coliver said in Server 2012: PS Get-ADGroupMember:

                                        @travisdh1 said in Server 2012: PS Get-ADGroupMember:

                                        @coliver said in Server 2012: PS Get-ADGroupMember:

                                        Did you do

                                        Import-Module ActiveDirectory

                                        ?

                                        One of my major pain-points with PowerShell. Why does every module have to be manually loaded. It's not like you have to load them into memory until it's actually needed.

                                        The new PowerShell core seems to auto import modules when you use a command from them.

                                        Why was that missing from day 1? Seriously!

                                        scottalanmillerS coliverC 2 Replies Last reply Reply Quote 0
                                        • scottalanmillerS
                                          scottalanmiller @travisdh1
                                          last edited by

                                          @travisdh1 said in Server 2012: PS Get-ADGroupMember:

                                          @coliver said in Server 2012: PS Get-ADGroupMember:

                                          @travisdh1 said in Server 2012: PS Get-ADGroupMember:

                                          @coliver said in Server 2012: PS Get-ADGroupMember:

                                          Did you do

                                          Import-Module ActiveDirectory

                                          ?

                                          One of my major pain-points with PowerShell. Why does every module have to be manually loaded. It's not like you have to load them into memory until it's actually needed.

                                          The new PowerShell core seems to auto import modules when you use a command from them.

                                          Why was that missing from day 1? Seriously!

                                          If you wanted stuff like that, you'd be using BASH.

                                          travisdh1T 1 Reply Last reply Reply Quote 0
                                          • travisdh1T
                                            travisdh1 @scottalanmiller
                                            last edited by

                                            @scottalanmiller said in Server 2012: PS Get-ADGroupMember:

                                            @travisdh1 said in Server 2012: PS Get-ADGroupMember:

                                            @coliver said in Server 2012: PS Get-ADGroupMember:

                                            @travisdh1 said in Server 2012: PS Get-ADGroupMember:

                                            @coliver said in Server 2012: PS Get-ADGroupMember:

                                            Did you do

                                            Import-Module ActiveDirectory

                                            ?

                                            One of my major pain-points with PowerShell. Why does every module have to be manually loaded. It's not like you have to load them into memory until it's actually needed.

                                            The new PowerShell core seems to auto import modules when you use a command from them.

                                            Why was that missing from day 1? Seriously!

                                            If you wanted stuff like that, you'd be using BASH.

                                            Whenever I'm given the choice, BASH, zsh, etc, all better than PowerShell.

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post