EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

PowerShell Get-ADGroup

Home » Data Science » Data Science Tutorials » PowerShell Tutorial » PowerShell Get-ADGroup

PowerShell Get-ADGroup

Introduction to PowerShell Get-ADGroup

The following article provides an outline for PowerShell Get-ADGroup. The Get-ADGroup cmdlet is used to fetch information about one or more Active directory groups. A group can be identified in many ways like using its Distinguished name, GUID of the group, SID of the group or SAM account name. In scenarios that involve retrieving multiple Active directory groups Filter or LDAPFilter is used. The queries used by the filter condition are written using the PowerShell expression language which supports type conversion to different types.This

Syntax of PowerShell Get-ADGroup

Given below are the syntax of the Get-ADGroup cmdlet:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Get-ADGroup  [-AuthType <ADAuthType>]   [-Credential <PSCredential>]   -Filter <String>   [-Properties <String[]>]   [-ResultPageSize <Int32>]   [-ResultSetSize <Int32>]   [-SearchBase <String>]   [-SearchScope <ADSearchScope>]   [-Server <String>]   [<CommonParameters>]

Get-ADGrou   [-AuthType <ADAuthType>]   [-Credential <PSCredential>]   [-Identity] <ADGroup>   [-Partition <String>]   [-Properties <String[]>]   [-Server <String>]   [<CommonParameters>]

Get-ADGroup   [-AuthType <ADAuthType>]   [-Credential <PSCredential>]   -LDAPFilter <String>   [-Properties <String[]>]   [-ResultPageSize <Int32>]   [-ResultSetSize <Int32>]   [-SearchBase <String>]   [-SearchScope <ADSearchScope>]   [-Server <String>]   [<CommonParameters>]

Parameters:

1. Credential: This alludes to the client account that will be utilized to run the cmdlet. By default, the qualifications of the current client are considered unless the cmdlet is run from the active directory drive. In such a situation, the account that’s related to the drive is considered. Either a username or PSCredential is provided as esteem to the parameter. In case a username is indicated, a prompt is given for the password. The account indicated ought to have directory-level authorization else the cmdlet will come up with an error message. Its sort is PSCredential. The parameter cannot acknowledge pipeline input and wild card characters are too not permitted.

2. Authtype: This signifies the verification strategy to be utilized to put through to the active directory. It can be either of two values, negotiate(0) or basic(1), with negotiate being the default authentication mode. An SSL association is required for the basic authentication mechanism to work. The sort of param is ADAuthType. It doesn’t acknowledge pipeline input; wildcard characters are too not permitted.

Popular Course in this category
Sale
Shell Scripting Training (4 Courses, 1 Project)4 Online Courses | 1 Hands-on Project | 18+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (8,751 ratings)
Course Price

View Course

Related Courses
All in One Data Science Bundle (360+ Courses, 50+ projects)Data Visualization Training (15 Courses, 5+ Projects)

3. Identity: This is an obligatory parameter. This indicates the Active directory group that needs to be fetched. A unique title, GUID of the client within the Dynamic registry, SID, or SAM account title can be passed as the value. The sort of this parameter is ADGroup. Its default esteem is none. This parameter acknowledges pipeline input but doesn’t allow wild card characters.

Example of unique name:

CN=test, OU=test, CN=users, DC=corp, DC=test, DC=com

Example of GUID:

050c3d2e-f73e-4f20-8a99-030d92425f20

4. Filter: This indicates the inquiry that’s utilized to bring the objects from the Active directory. It follows the sentence structure of PowerShell express dialect. PowerShell express dialect has great type-conversion back. Its sort is a string and default esteem is none. This parameter doesn’t acknowledge pipeline input and wild card characters are too not backed.

Example:

Get-ADGroup -Filter “GroupCategory -eq’Distribution’”

Get-ADGroup -Filter “GroupScope -eq ‘Universal’”

5. LDAPFilter: This refers to the LDAP condition that is used for filtering purposes. It’s like the filter of LDAP syntax. The datatype of this parameter is a string. This parameter doesn’t acknowledge pipeline input and wild card characters are too not backed.

6. Partition: This alludes to an Active directory block. It must be the title of one of the current registry servers. This partition is looked to distinguish the question that’s alluded to by the character parameter. On the off chance that no esteem is indicated, default esteem is utilized. In case the esteem passed to the identity parameter may be a recognized title, the default esteem is naturally created from this and treated as the partition title. On the off chance that the cmdlets are run from the dynamic catalog supplier, the current way within the drive is treated as the default esteem of the segment. The information sort for this parameter is a string and default esteem is none. Both pipeline input and wild card characters are not acknowledged by this parameter.

7. Properties: This indicates the list of properties of the Active directory protest to be returned. To recover different properties, partition them employing a comma. To recover all properties, utilize the *. The information sort of this parameter is string[]. The default esteem is none. Both pipeline input and wild card characters are not acknowledged by this parameter.

8. ResultPageSize: This signifies the number of objects to be displayed on a single page of the inquiry comes about. Its sort is int32. The default is 256. Both pipeline input and wild card characters are not acknowledged by this parameter.

9. ResultSetSize: This indicates the most extreme number of objects that ought to be returned by the inquiry. If all the properties ought to be returned, null esteem must be passed to this parameter. Its information sort is int32. Both pipeline input and wild card characters are not acknowledged by this parameter.

10. -SearchBase: This indicates the pathway beneath which the seek for the object search must happen. On the off chance that the cmdlet is run from the dynamic catalog drive, the current way of the drive is considered as the default esteem. On the off chance that the cmdlet is run from the exterior, at that point, the target’s drive is taken as default esteem. The information sort is string and default esteem is none. Both pipeline input and wild card characters are not acknowledged by this parameter.

11. SearchScope: This indicates the scope of the rummage around for the search objects. It can accept three values as Base or 0, one level or 1, and subtree or 2. Base scope searches only for the specified client. One level rummages around for the children of protest, subtree looks for all children of the said question.

12. Server: This signifies the dynamic registry to put through to. The space values can be either of FQDN or netbios title. The default esteem can be either the space where the cmdlet is run or the active directory drive server or the one that’s passed to the parameter.

Example of PowerShell Get-ADGroup

Given below is the example of PowerShell Get-ADGroup:

Code:

Write-Host "Welcome to the Get AD group example"
write-host "Fetching the user details based on identity"
Get-ADGroup -Identity o365
Write-Host "Fetching the group details using sid"
Get-ADGroup -Identity 'S-0-5-22-644'
write-host "Example of filtering the group"
Get-ADGroup -Filter "GroupScope -eq 'DomainLocal'"

Output:

PowerShell Get-ADGroup 1

PowerShell Get-ADGroup 2

Conclusion

In this way, the article clarified in detail approximately the Get-ADGroup cmdlet in PowerShell. It secured the parameters that are related to the cmdlet alongside channels. To memorize more in detail, it is fitting to compose test scripts and hone them.

Recommended Articles

This is a guide to PowerShell Get-ADGroup. Here we discuss the introduction to PowerShell Get-ADGroup along with examples respectively. You may also have a look at the following articles to learn more –

  1. Else If in PowerShell
  2. Windows PowerShell ISE
  3. PowerShell Functions
  4. PowerShell String Replace

All in One Data Science Bundle (360+ Courses, 50+ projects)

360+ Online Courses

50+ projects

1500+ Hours

Verifiable Certificates

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
PowerShell Tutorial
  • Basics
    • PowerShell comment
    • PowerShell Map Network Drive
    • PowerShell Append to File
    • PowerShell print
    • What is PowerShell
    • Uses Of Powershell
    • PowerShell Versions
    • How To Install PowerShell
    • PowerShell uninstall module
    • How to Use PowerShell?
    • PowerShell Logging
    • PowerShell Tools
    • PowerShell Commands
    • PowerShell Administrator
    • PowerShell Modules
    • PowerShell Registry
    • PowerShell block Comment
    • PowerShell Verbs
    • PowerShell list
    • PowerShell add user to group
    • PowerShell Write to Console
    • Variable in PowerShell
    • PowerShell New Line
    • PowerShell prompt for input
    • PowerShell File Extension
    • Powershell Remotesigned
    • PowerShell Write to File
    • PowerShell Ping
    • PowerShell wget
    • PowerShell Global variable
    • PowerShell Get-ADGroup
    • Array in PowerShell
    • PowerShell Multidimensional Array
    • PowerShell Array of Strings
    • PowerShell? join array
    • Useful PowerShell Scripts
    • String in PowerShell
    • PowerShell Switch Statement
    • PowerShell Function Parameters
    • PowerShell vs PowerShell ISE
    • PowerShell test-connection
    • PowerShell Test-NetConnection
    • PowerShell GUI
    • PowerShell Variable in String
    • PowerShell Active Directory
  • Variables
    • PowerShell Variables
    • PowerShell Environment Variables
    • PowerShell set environment variable
    • Hashtable in PowerShell
    • Set Variable in PowerShell
  • Operators
    • PowerShell Operators
    • Comparison Operators in PowerShell
    • Logical Operators in PowerShell
    • PowerShell Boolean
    • PowerShell Like Operator
  • cmdlet
    • PowerShell Wait
    • PowerShell Match
    • cmdlets in PowerShell
    • Start PowerShell from cmd
    • Add-Content in PowerShell
    • Get Help in PowerShell
    • PowerShell Copy-Item
    • PowerShell Remove-Item
    • PowerShell Move-Item
    • Get Command in PowerShell
    • PowerShell Run Command
    • Windows PowerShell ISE
    • Windows Powershell Commands
    • WinRM PowerShell
    • PowerShell Date
    • Powershell Write-Host
    • PowerShell Get-ChildItem
    • PowerShell Sort-Object
    • PowerShell Where Object
    • PowerShell Set-Content
    • PowerShell Set-Location
    • PowerShell Invoke-Command
    • PowerShell Invoke-Webrequest
    • PowerShell Get-Location
    • PowerShell Get-Date
    • PowerShell Get-Service
    • PowerShell Test-Path
    • Powershell Module Path
    • PowerShell Out-File
    • PowerShell if File Exists
    • Powershell Copy File
    • PowerShell Delete File
    • PowerShell New-Item
    • PowerShell Rename-Item
    • PowerShell ComputerName
    • PowerShell Get-Content
    • PowerShell Get-Item
    • PowerShell Get-ADUser
    • PowerShell Grep
    • PowerShell Concatenate String
    • PowerShell Get-Process
    • PowerShell Count
    • PowerShell pause
  • Control Statements
    • If Statement in PowerShell
    • If Else in PowerShell
    • Else If in PowerShell
    • Loops in PowerShell
    • For loop in PowerShell
    • PowerShell While Loop
    • PowerShell do while
    • PowerShell Loop through Array
    • PowerShell add to array
    • PowerShell ForEach Loop
    • PowerShell Break
    • PowerShell Continue
    • Switch Case in PowerShell
    • PowerShell If-Not
    • Try-catch in PowerShell
  • Functions
    • PowerShell Functions
    • PowerShell String Functions
    • powershell nslookup
    • PowerShell here string
    • PowerShell Wildcards
    • Regex in PowerShell
    • PowerShell not like
    • PowerShell Filter
    • PowerShell Sleep
    • PowerShell where
    • PowerShell join string
    • PowerShell Exit
    • PowerShell null
    • PowerShell Dictionary
    • PowerShell Location
    • PowerShell Trim
    • PowerShell Join-Path
    • PowerShell Execution Policy
    • PowerShell SubString
    • PowerShell Format Table
    • PowerShell Import Module
    • PowerShell ForEach Object
    • PowerShell Alias
    • PowerShell Scheduled Task
    • PowerShell Convert String to Date
    • PowerShell Split String
    • PowerShell Multiline String
    • PowerShell MultiLine Comment
    • PowerShell Rename Folder
    • PowerShell Delete Folder
    • PowerShell String Replace
    • PowerShell join
    • PowerShell xcopy
    • PowerShell Base64
    • PowerShell Tail
    • PowerShell User List
    • PowerShell remove User from group
    • PowerShell JSON Format
    • PowerShell Send Mail
    • PowerShell Convert to String
    • PowerShell Start-Process
    • PowerShell change directory
    • PowerShell Open File
    • PowerShell Batch File
    • PowerShell ZIP
    • PowerShell unzip
    • PowerShell XML
    • PowerShell XML Parsing
    • Remote PowerShell
    • PowerShell Escape Character
    • PowerShell scriptblock
    • PowerShell Executable Location
    • PowerShell Import-CSV?
    • PowerShell Export CSV
  • Interview Questions
    • PowerShell Interview Questions

Related Courses

Shell Scripting Course

All in One Data Science Courses

Data Visualization Courses

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - Shell Scripting Course Learn More