I have been working on a report that would return all assets scanned by specific servers that either do or do not have SCCM service running. If the service is running, show the StartMode of the service and also show the version of the executable (ccmexec.exe). So far I can only get returns for devices where the service is running. Maybe I'm over thinking the query... Any insight would be greatly appreciated.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysOS.OSname,
tblAssets.IPAddress,
tblServiceStartMode.StartMode,
tblFileVersions.FileVersion,
tblAssets.Lastseen
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblFileVersions On tblAssets.AssetID = tblFileVersions.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join tblServices On tblAssets.AssetID = tblServices.AssetID
Inner Join tblServicesUni On tblServices.ServiceuniqueID =
tblServicesUni.ServiceuniqueID
Inner Join tblServiceStartMode On tblServiceStartMode.StartID =
tblServices.StartID
Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where tblServicesUni.Name = N'CcmExec' And tblFileVersions.FilePathfull Like
'%CcmExec.exe' And (tblFileVersions.Found = 'False' Or tblFileVersions.Found =
'True') And tblAssets.Scanserver Like 'xxxxxxxxxx%' And
tblAssetCustom.State = 1
Order By tblAssets.AssetName