Useful Power Shell Commands for Active Directory

                                     
                                  


                              ***** Active Directory Power Shell Command *****

Command 1 > Get list of AD Users in csv file

Below Command will give details with selected properties.

get-aduser -filter * -Properties DisplayName, EmailAddress, samAccountName, office, Description | Select DisplayName, EmailAddress, samAccountName, office, Description | Export-csv D:\test5.csv

Below Command will give all details with all properties.

get-aduser -Filter * -Properties * | Export-csv -path C:\Users\Technv\Desktop\ADUsers2019.csv -NoTypeInformation -Encoding UTF8

Command 2 > Get list of AD Computers in csv file


Below Command will give all computer hostname details with all properties. 


This Command will give all Computer List with All properties details
Get-ADComputer -Filter * -Properties * | Export-csv -path C:\Users\Technv\Desktop\ADComputerList1.csv -NoTypeInformation -Encoding UTF8


Command 3 > Get list of Group Members in csv file

Below Command will give Group members list in csv file. 

Get-ADGroupMember -identity "Test Group" | Export-csv -path C:\Users\Technv\Desktop\GroupMembers.csv -NoTypeInformation


Command 4 > Get list of OU and sub OU details in csv file

Below Command will give OU and Sub OU list in csv file.


Get-ADOrganizationalUnit -Filter * -Properties CanonicalName | Select-Object -Property CanonicalName | Export-csv -path C:\Users\Technv\Desktop\OUandSubOu.csv -NoTypeInformation

Subscribe to our YouTube Channel Technv

Comments

Post a Comment