Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Introduction to SCCM Query Collection and its Importance
System Center Configuration Manager (SCCM) is a powerful tool used by Microsoft Systems Engineers to manage and deploy software, updates, and configurations across a network of Windows systems. SCCM Query Collection allows administrators to create and run queries to gather specific information from the managed systems. In this article, we will focus on creating and running a query collection to find Windows systems with a specific Build Number, specifically Build Number 10586. This information can be crucial for various purposes such as software compatibility checks, update management, and system inventory.
Examples:
To create and run the SCCM query collection, we will be using the SCCM console, SQL queries, and PowerShell commands. Let's go through the step-by-step process:
Now that we have created the SCCM query collection, let's explore how to run it via CMD and how to retrieve the results programmatically using PowerShell.
To run the query collection via CMD, follow these steps:
CMQuery.exe /collection:<CollectionID>
Replace <CollectionID>
with the actual ID of the query collection you created.
The CMD output will display the results of the query collection, including the name, operating system, and build number of the Windows systems that match the criteria.
To retrieve the results programmatically using PowerShell, you can utilize the SCCM PowerShell module. Here's an example script:
Import-Module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')
$siteCode = "ABC" # Replace with your SCCM site code
$siteServer = "SCCMServer" # Replace with your SCCM server name
Set-Location "$siteServer\$siteCode:"
$queryCollectionID = "XYZ" # Replace with the actual ID of the query collection
$queryResults = Get-CMDevice -CollectionID $queryCollectionID
foreach ($result in $queryResults) {
Write-Host "Name: $($result.Name)"
Write-Host "Operating System: $($result.OperatingSystem)"
Write-Host "Build Number: $($result.BuildNumber)"
Write-Host "-----------------------"
}
Make sure to replace the placeholders with your SCCM site code, server name, and the actual ID of the query collection.