How To Export Collections in SCCM to CSV Using Powershell
SCCM GUI
- Navigate to Monitoring > Overview > Reporting > Reports > Asset Intelligence. This lists the various reports available.
- Click Hardware 01A - Summary of computers in a specific collection.
- Select the collection for which you want to generate the report.
- Click Run.
Enter Powershell
Powershell is a nifty tool, not just for SQL Server DBAs, but for anyone working in a Windows environment. You can quickly generate this report using Powershell. Here's how I did it:[String]$CollectionID = "CollectionID" #replace with the CollectionID that you want to generate the report for [String]$SiteCode = "SiteCode" #This is the site code for the SCCM [String]$Outfile= "C:\Pythian\Servers-Running SQL-Servers.csv" #Location where you want to drop the file. $delimiter = ',' Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" Set-Location "$SiteCode`:" $Servers = Get-CMCollectionMember -CollectionId $CollectionID | Select-Object Name,Status,DeviceOS,DeviceOSBuild,IsVirtualMachine,IsActive,LastActiveTime,IsDecommissioned,SerialNumber,MACAddress,CNLastOnlineTime,CoManaged $Servers | ConvertTo-Csv -Delimiter $delimiter -NoTypeInformation | out-file $Outfile -encoding ascii
This gets the job done. You can change the columns in Select-Object to gather the information you require. If you're going to do this more than once, you can improve the script and make it a parameterized function. You can also select a different output format using the various ConverTo commandlets. Improve and modify the script as required.
SQL Server Database Consulting Services
Ready to future-proof your SQL Server investment?
On this page
Share this
Share this
More resources
Learn more about Pythian by reading the following blogs and articles.
Fix: SQL Server to PostgreSQL Linked Server Error - "Requested conversion is not supported."
Fix: SQL Server to PostgreSQL Linked Server Error - "Requested conversion is not supported."
Jun 3, 2019 12:00:00 AM
5
min read
MSDTC and configuration details for cluster/Always On

MSDTC and configuration details for cluster/Always On
Oct 24, 2022 12:00:00 AM
8
min read
Troubleshooting SSPI handshake error
Troubleshooting SSPI handshake error
Dec 5, 2011 12:00:00 AM
2
min read
Ready to unlock value from your data?
With Pythian, you can accomplish your data transformation goals and more.