create sccm query for *. xml file and location c:\sam

create sccm query for *. xml file and location c:\sam

In SCCM (System Center Configuration Manager), you can create a query to find XML files located in the C:\sam\sam directory by following these steps:

  1. Open the SCCM console.
  2. Navigate to the “Monitoring” or “Assets and Compliance” workspace, depending on your SCCM version.
  3. Go to “Queries” and create a new query.
  4. Provide a suitable name and description for your query.
  5. Choose “Edit Query Statement” or a similar option to define the query criteria.

In the query statement, you can use the Win32_FileSystem class along with the LIKE operator to search for XML files in the specified directory. Here’s an example query statement:

sqlCopy code

SELECT * FROM SMS_R_System JOIN SMS_G_System_SoftwareFile ON SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId WHERE SMS_G_System_SoftwareFile.FileName LIKE '%.xml' AND SMS_G_System_SoftwareFile.FilePath LIKE 'C:\\sam\\sam\\%'

Explanation of the query:

  • SMS_R_System represents the collection of resources (computers) in SCCM.
  • SMS_G_System_SoftwareFile is a class that provides file information.
  • FileName LIKE '%.xml' specifies that the file name should end with .xml.
  • FilePath LIKE 'C:\\sam\\sam\\%' filters files located in the C:\sam\sam directory.

Please ensure that you modify the query as needed based on your SCCM environment, namespace, and the specific requirements or schema of your SCCM database.

Once the query is created and executed, it will display the computers that have XML files located in the specified directory (C:\sam\sam).