Saturday, 29 July 2023

Active Directory Power Shell Basic Command

Active Directory Power Shell Basic Command


Get All User

Get-ADUser -Filter *

Get Singal User

Get-ADUser 'Username'


Get Computer Full Details

Get-ADComputer -Filter *

Get Computer Details for Single Computer

Get-ADComputer -Filter ‘Computer Name’

How to check user enable or disable in Power Shell Command

Get-ADUser 'UserName' | select enabled (Show Only Enabled User)


Get-ADUser 'UserName' | select disabled (Show Only Disabled User)

Get-ADUser -Filter * | select name, enabled

Get Ad Group

Get –adgroup ‘ Groupname’

Get –adgroup  -Filter  * | Select Name


Get Group Member

 Get-ADGroupMember ‘GroupName’


You Can Sort as Required Filed. EX.


Get-ADGroupMember  ‘GroupName’  | select name

Get-ADGroupMember  -Identity  ‘groupName’ | select distinguishedname or name

Export Group Member to Csv File

Get-ADGroupMember -Identity ‘GroupName’ | export-csv  -path c:\abc.csv  -noTypeinformation

How Enable or Disable User Account or Computer in Power Shell

Disable-ADAccount -Identity "User"
Enable-ADAccount -Identity "User"

Unlock-ADAccount -Identity "User"

Locate disabled computer or user accounts


Search-ADAccount -AccountDisabled | FT Name,ObjectClass

Add or Remove Group Member in the Group

 Add-ADGroupMember  SecurityGroupName  -Members Username01

Remove –ADGroupMember SecurityGroupName –Members Username01

1 comment: