Here's a PowerShell script that exports all computer objects from Active Directory to a CSV file:
Ps1# Get all computer objects from AD $computers = Get-ADComputer -Filter * # Export the computer objects to a CSV file
$computers | Export-Csv -Path "C:\Computers.csv" -NoTypeInformation
This script uses the Get-ADComputer cmdlet to retrieve all computer objects from AD, and then pipes the output to the Export-Csv cmdlet to export the data to a CSV file. The -NoTypeInformation parameter is used to exclude the type information header from the output file. The file is saved to the C:\ drive with the name Computers.csv.
No comments:
Post a Comment