Question : SCCM Query for systems with a specific File Name & Specific Version of that file

I need to build a query that will show me systems that have a specific file of a specific version.

The query below gets me all systems with that specific file.

select SMS_G_System_COMPUTER_SYSTEM.Name, SMS_G_System_SoftwareFile.FilePath, SMS_G_System_SoftwareFile.CreationDate, SMS_G_System_SoftwareFile.FileDescription, SMS_R_System.ResourceType, SMS_R_System.ResourceId from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName = "rtvscan.exe"

But I need all systems with that specific file and a specific versionlike version 10, or version 9, or version 8.3.289.1,  etc....

Ideally I need to use the query to find systems with any iteration of version 8, version 9, and version 10 of that file, so I need to use something along the lines of fileversion like "10%" or fileversion like "9%" etc...

I will  then use the query to build a collection of all the computers with that file and version.

Query # 1  - select SMS_G_System_COMPUTER_SYSTEM.Name, SMS_G_System_SoftwareFile.FilePath, SMS_G_System_SoftwareFile.CreationDate, SMS_G_System_SoftwareFile.FileDescription, SMS_R_System.ResourceType, SMS_R_System.ResourceId from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName = "rtvscan.exe" --> and like version 10%

Query # 2  - select SMS_G_System_COMPUTER_SYSTEM.Name, SMS_G_System_SoftwareFile.FilePath, SMS_G_System_SoftwareFile.CreationDate, SMS_G_System_SoftwareFile.FileDescription, SMS_R_System.ResourceType, SMS_R_System.ResourceId from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName = "rtvscan.exe" --> and like version 9%

Query # 3  - select SMS_G_System_COMPUTER_SYSTEM.Name, SMS_G_System_SoftwareFile.FilePath, SMS_G_System_SoftwareFile.CreationDate, SMS_G_System_SoftwareFile.FileDescription, SMS_R_System.ResourceType, SMS_R_System.ResourceId from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName = "rtvscan.exe" --> and like version 8%

My problem is I can't construct that last part properly so I get the computers that have the specific version of that specific file...

Any help would be greatly appreciated.

Answer : SCCM Query for systems with a specific File Name & Specific Version of that file

Try something like:
1:
select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client from SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName = "rtvscan.exe" and SMS_G_System_SoftwareFile.FileVersion like "8.%"
Random Solutions  
 
programming4us programming4us