EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials PowerShell Tutorial PowerShell Get-ADUser
Secondary Sidebar
PowerShell Tutorial
  • 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
  • Basics
    • PowerShell Restart Service
    • PowerShell comment
    • PowerShell Map Network Drive
    • PowerShell Append to File
    • PowerShell print
    • What is PowerShell
    • Uses Of Powershell
    • PowerShell Empire
    • PowerShell Parameter
    • PowerShell Stop Service
    • PowerShell Versions
    • How To Install PowerShell
    • PowerShell uninstall module
    • How to Use PowerShell?
    • PowerShell Logging
    • PowerShell Tools
    • PowerShell Commands
    • PowerShell Version Command
    • 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
  • 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 Start-Service
    • PowerShell is not digitally signed
    • PowerShell Uptime
    • PowerShell Create Directory
    • 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

PowerShell Get-ADUser

By Priya PedamkarPriya Pedamkar

PowerShell Get-ADUser

Introduction to PowerShell Get-ADUser

The Get-ADUser cmdlet is used to fetch information about one or more active directory users. A user can be identified by using several parameters like his distinguished name, the corresponding GUID in active directory, Security Identifier, or SAM(Security Account Manager) name. To fetch multiple user’s information Filter or LDAPFilter can be used. PowerShell expression language is used by the filter parameters to fetch information from the Active Directory. This article will cover in detail about this cmdlet along with appropriate explanations and examples.

Syntax and Parameters

Syntax and parameters of Powershell get-ADUser are given below:

Syntax:

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

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Parameters:

Parameters of Powershell get-aduser are

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (86,650 ratings)
  • -AuthType: This denotes the authentication method to be used to connect to Active directory. It can be either of two values, negotiate also can be referred to as 0 or Basic otherwise can be referred to as 1. Negotiate is the default used authentication mode. For basic authentication to work, an SSL connection is required. The type of param is ADAuthType. It doesn’t accept pipeline input; wildcard characters are also not allowed.
  • -Credential: This refers to the user account that will be used to run the cmdlet. By default, the credentials of the current user are considered unless the cmdlet is run from the drive of the Active Directory. In such a scenario, the account that is associated to the drive is considered. Either username or PSCredential object is supplied as value to the parameter. In case if a username is specified, a prompt is given for a password. The account specified should have directory-level permission else the cmdlet will fail throwing an error. Its type is PSCredential. The parameter can not accept pipeline input and wild card characters are also not allowed.
  • -Filter: This denotes the query that is used to fetch the objects from the active directory. It uses the syntax of PowerShell express language. PowerShell express language has good type-conversion support. Its type is a string and the default value is none. This parameter doesn’t accept pipeline input and wild card characters are also not supported.
  • -Identity: This is a mandatory parameter. This denotes the Active directory user whose details should be fetched. The following values can be passed as the identity parameter. A unique name, GUID of the user in the Active directory, SID or SAM account name. The type of this parameter is ADUser. Its default value is none. This parameter accepts pipeline input but doesn’t permit wild card characters.
  • -LDAPFilter: This denotes the LDAP query that is used for filtering purposes. The filter parameter is like LDAP syntax. Its type is a string. Both the input pipeline and wild card characters are not supported by this parameter.
  • -Partition: This refers to an Active Directory partition. It must be the name of one of the current directory servers. This partition is searched to identify the object that is referred by the identity parameter. If no value is specified, the default value is used. If the value passed to the identity parameter is a distinguished name, the default value is automatically generated from this and treated as the partition name. If the cmdlets are run from the active directory provider, the current path in the drive is treated as the default value of the partition. The data type for this parameter is a string and the default value is none. Both pipeline input and wild card characters are not accepted by this parameter.
  • -Properties: This denotes the list of properties of the Active Directory object to be returned. To retrieve multiple properties, separate them using a comma. To retrieve all properties, use the *. The data type of this parameter is a string[]. The default value is none. Both pipeline input and wild card characters are not accepted by this parameter.
  • -ResultPageSize: This denotes the number of objects to be present in a single page of the query results. Its type is int32. The default is 256. Both pipeline input and wild card characters are not accepted by this parameter.
  • -ResultSetSize: This denotes the maximum number of objects that should be returned by the query. If all the properties need to be returned, the null value must be passed to this parameter. Its data type is int32. Both pipeline input and wild card characters are not accepted by this parameter.
  • -SearchBase: This denotes the AD path under which the search for the specified object must occur. If the cmdlet is run from the active directory drive, the current path of the drive is considered as the default value. If the cmdlet is run from outside, then the targets drive is taken as default value. The data type is a string and the default value is none. Both pipeline input and wild card characters are not accepted by this parameter.
  • -SearchScope: This denotes the scope of the search for the AD object. It has three values. Base or 0, one level or 1 and subtree or 2. Base scope searches only for the mentioned user. One level search for the children of an object, subtree searches for all children of the mentioned object.
  • -Server: This denotes the active directory to connect to. The domain values can be either of FQDN or netbios name. The default value can be either the domain where the cmdlet is run or the active directory drive server or the one that is passed to the parameter.

Example of PowerShell Get-ADUser

Example of Powershell get-aduser are given below:

Input:

Write-Host "Welcome to the Get user from ad example"
write-host "Fetching the user details based on identity"
Get-ADUser -Identity vkrishna
Write-Host "Fetching the user detail using SID"
Get-ADUser -Identity 'v-1-5-21-00000001-1234593942-696130396-3142'
write-host "Example of filter"
Get-AdUser -Filter "givenName -eq 'Dave'"

Output:

PowerShell Get-ADUser-1.1

PowerShell Get-ADUser-1.2

Recommended Articles

This is a guide to PowerShell Get-ADUser. Here we also discuss the syntax and parameters of Powershell get-aduser along with an example and its code implementation. you may also have a look at the following articles to learn more –

  1. Else If in PowerShell
  2. Windows PowerShell ISE
  3. PowerShell Get-Service
  4. PowerShell Functions
Popular Course in this category
PowerShell Training (2 Courses, 1 Project)
  2 Online Courses |  1 Hands-on Project |   4+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Shell Scripting Training (4 Courses, 1 Project)4.9
All in One Data Science Bundle (360+ Courses, 50+ projects)4.8
Data Visualization Training (15 Courses, 5+ Projects)4.7
0 Shares
Share
Tweet
Share
Primary Sidebar
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

ISO 10004:2018 & ISO 9001:2015 Certified

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

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*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 Login

Forgot Password?

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

*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.

Let’s Get Started

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

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more