Showing posts with label get-aduser export-csv examples. Show all posts
Showing posts with label get-aduser export-csv examples. Show all posts

Wednesday 7 June 2017

PowerShell command to export AD uses created in last 7 days in to a CSV file

Or, Exporting AD users created in last 7 days to CSV file using PowerShell command
Or, Get AD users report created in last 7 days with the help of PowerShell


Descriptions:  If you are looking for exporting AD users created in last 7 days or any custom days in a CSV file/report, this article is for you my friend. In my case, I am going to export users created in last 7 days.

Steps:
Run Windows PowerShell as Administrator > run the commands mentioned below to get the CSV output/report

AD users created in last 7 days

Get-ADUser -Filter "Name -like '*'" -Properties Name, Title, Office, Created | where {$_.Created -gt $(Get-Date).AddDays("-7")} | select Name, Title, Office | Export-Csv D:\temp\ADReport.csv


Cheers, Please write me back if you have any query or feedback on this.

Sunday 4 June 2017

Exporting AD users to CSV file using PowerShell command

Or, PowerShell command to export AD users in to a CSV file
Or, Get AD users report with all fields or selected fields with the help of PowerShell

Descriptions:  In this article, we are going to try some useful PowerShell commands to export AD users reports. You have choice to select many properties values, less properties values or all properties value as per your need.

Steps:

Run Windows PowerShell as Administrator > run the commands mentioned below to get the CSV output/report

AD user’s reports with some most commonly used fields
Get-ADUser -Filter '*' -Properties * | Select -Property EmailAddress,GivenName,Surname,DisplayName,Title,Department,Office,OfficePhone,MobilePhone,Fax,StreetAddress,City,State,PostalCode,Country | Export-CSV "D:\temp\ADusers.csv" -NoTypeInformation -Encoding UTF8

AD Users report with less fields
Get-ADUser -Filter '*' -Properties * | select -Property SamAccountName,DisplayName,EmailAddress | Export-CSV "D:\temp\ADusers2.csv" -NoTypeInformation -Encoding UTF8

AD users reports with all available fields
Get-ADUser -Filter '*' -Properties * | Export-CSV "D:\temp\ADusersAllFlds.csv" -NoTypeInformation -Encoding UTF8


The reference screenshot is given below to see how the commands should look like on PowerShell.







Cheers, Please write me back if you have any query or feedback on this.