Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

How to get Active Directory Group Scope - Local Domain, Global Group, Universal Group with Powershell

31 August,2021 by Tom Collins

Question : How can I find the Active Directory Group group scope -  Local Domain, Global Group, Universal Group with Powershell? 

Answer: Powershell  has a range of cmdlets to access and read the Active Directory . One of the Powershell cmdlets is Get-ADGroup - which retrieves a group or groups from Active Directory. 

This is an example of returning all the columns for all AD groups on a specific server , where the string "DBA Team" is part of the AD group name 

    Get-ADGroup -Filter "name -like '*DBA Team*'" -Properties * -server "myADserver.net" | select *

As part of the resultset - there is a column called "Group Scope" . This "GroupScope" column returns the values required - Local Domain, Global Group, Universal Group.

To return only the relevant columns i.e name and group scope  use something similar to the below

    Get-ADGroup -Filter "name -like '*DBA Team*'" -Properties * -server "myADserver.net" | select name,groupscope

 

Read more on Active Directory AD group 

 How to find Active Directory users with Get-ADUser search filter

How to get DOMAIN login name with Powershell Get-ADGroupMember

How to Export Active Directory Group Members with Powershell Get-ADGroupMember 

 

 


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to get Active Directory Group Scope - Local Domain, Global Group, Universal Group with Powershell


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer