Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Create and Run SCCM Query Collection to Find Windows Systems with Build Number 10586

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:

  1. Launch the SCCM console and navigate to the "Assets and Compliance" workspace.
  2. Expand the "Queries" node and right-click on "Query Rules." Select "Create Query Rule" from the context menu.
  3. In the "General" tab, provide a name and description for the query collection. For example, "Windows Systems with Build Number 10586."
  4. Switch to the "Criteria" tab and click on the "Add Clause" button.
  5. In the "Attribute" drop-down list, select "Operating System" and then choose "Build Number" as the attribute.
  6. Set the operator to "Equals" and enter "10586" in the value field.
  7. Click on the "OK" button to save the criteria.
  8. Switch to the "Results" tab and choose the desired columns to be displayed in the query collection results. For example, "Name," "Operating System," and "Build Number."
  9. Click on the "OK" button to save the query collection.

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:

  1. Open the Command Prompt as an administrator.
  2. Navigate to the SCCM installation directory. By default, it is located at "C:\Program Files\Microsoft Configuration Manager\AdminConsole\bin."
  3. Execute the following command to run the query collection:
    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.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.