Export AD Computers To CSV Using PowerShell - MorganTechSpace
Maybe your like
Find and List AD Computers
The following powershell script list the selected properties of all computers.
Import-Module ActiveDirectory Get-ADComputer -Filter * -Properties * | Select -Property Name,operatingSystem,@{Name="LastLogon"; Expression={[DateTime]::FromFileTime($_.lastLogon).ToString()}}Apply SQL Like filter to get specific computers:
The Get-ADComputer cmdlet supports SQL like filter, users who are not familiar with LDAP filter can easily use this filter to get only specific set of AD computers. The following script select computers whose OperatingSystem contains the text ‘Server 2008 R2’.
Import-Module ActiveDirectory Get-ADComputer -Filter 'OperatingSystem -like "*Server 2008 R2*"' -Properties * | Select -Property Name,operatingSystem,@{Name="LastLogon"; Expression={[DateTime]::FromFileTime($_.lastLogon).ToString()}}Apply LDAP Filter to get specific set of AD computers:
If your are familiar with LDAP filter, instead of normal filter, you can also use LDAP filter with more flexibility to filter Active Directory computers. The below script select all the computers whose OperatingSystem contains the text ‘Server 2008 R2’.
Import-Module ActiveDirectory Get-ADComputer -LDAPFilter '(OperatingSystem=*Server 2008 R2*)' -Properties * | Select -Property Name,operatingSystem,@{Name="LastLogon"; Expression={[DateTime]::FromFileTime($_.lastLogon).ToString()}}Export AD Computers to CSV file
We can generate and export all computer details to CSV file by using Export-CSV cmdlet. You can add more attributes in Select -Property field to export more AD attributes.
Import-Module ActiveDirectory Get-ADComputer -Filter 'OperatingSystem -like "*Server 2008 R2*"' -Properties * | Select -Property Name,operatingSystem,@{Name="LastLogon"; Expression={[DateTime]::FromFileTime($_.lastLogon).ToString()}} | # Export AD Computer Report to CSV file Export-CSV "C:\ADComputers.csv" -NoTypeInformation -Encoding UTF8Export AD Computers from Specific OU
We can set target OU scope by using the parameter SearchBase. The following powershell script select all the Windows Server 2008 R2 AD computers from the Organization Unit ‘TestOU’ and export it to CSV file.
Import-Module ActiveDirectory Get-ADComputer -SearchBase "OU=TestOU,DC=TestDomain,DC=Local"` -Filter 'OperatingSystem -like "*Windows Server 2008 R2*"' -Properties * | Select -Property Name,operatingSystem,@{Name="LastLogon"; Expression={[DateTime]::FromFileTime($_.lastLogon).ToString()}} | # Export AD Computers to CSV file Export-CSV "C:\ADComputers.csv" -NoTypeInformation -Encoding UTF8CSV output of AD Computers Report:
Share this:
- X
Related Posts
- Export AD Users to CSV using PowerShell
- Export AD Users to CSV using Powershell Script
- Export Disabled AD Users to CSV with Powershell
- Export AD Group Members to CSV using Powershell
- Export Locked Out AD Accounts to CSV using Powershell
Leave a Comment Cancel reply
Comment
Name Email WebsiteSave my name, email, and website in this browser for the next time I comment.
Categories
- Powershell
- Microsoft 365
- Azure AD
- SharePoint Online
- Exchange Online
- Microsoft Teams
- Office 365 Groups
- Active Directory
- Microsoft Graph
- PnP-PowerShell
- CSOM
Recent Posts
- Get Azure AD (Entra ID) App-Only Access Token with PowerShell
- Working with REST API in PowerShell using Invoke-RestMethod
- M365 User SignIn Activity – Neither tenant is B2C or tenant doesn’t have premium license
- How to Join or Concatenate String and Number Using PowerShell
- Find Location and County by IP Address with PowerShell
- Microsoft 365
- Azure AD
- SharePoint Online
- Exchange Online
- Microsoft Teams
- Microsoft 365 Groups
- OneDrive for Business
- Azure AD Authentication
- Active Directory
- Exchange Server
- PowerShell
- PnP PowerShell
- Microsoft Graph
- CSOM
- VBScript
Follow us
Tag » Active Directory Export Computer List To Csv
-
Get-ADComputer- How To Find & Export AD Computers PowerShell
-
How To Export A Computer List From Active Directory - Netwrix
-
How To Export A Computer List From Active ... - Spiceworks Community
-
How To Get The Export Of All Computer Devices In Domain Via ...
-
Export Computer Object Information From Active Directory
-
How To Export A Computer List From Active Directory
-
Powershell: Export Active Directory Users To CSV - NetworkProGuide
-
Export AD Users To CSV With PowerShell - Active Directory Pro
-
Export All Windows Domain Computers To CSV From Windows - SvennD
-
How To Export Users From Active Directory - Admin's Blog - CodeTwo
-
Get Members Of An Active Directory Group And Export To CSV Using ...
-
Export Active Directory Data To CSV, Excel, And More - ManageEngine
-
Powershell: How To Export AD PC Results To CSV - Stack Overflow
-
How To Export Active Directory Users To CSV And Build Reports