cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JRall
Engaged Sweeper III

Hey all,

I am trying to create a report that shows all PC's with a certain software installed and excludes from the list/report if a particular key and value is set. I am needing this for an automated schedule, but I can't seem to figure out the syntax to exclude. Like this outside of just setting individual criteria which doesn't really work in this scenario.

Anyone have an example of something similar they may be able to post?

Thanks!

1 REPLY 1
JRall
Engaged Sweeper III

I think I figured it out based on another post I saw here (Solved: Report for missing registry keys - Lansweeper Community - 58474).

I did want to post what I have used below if it helps anyone else. Or, if there is a better way of handling something similar let me know. I am using this to deploy packages to PC's that are missing a particular registry key. The deployment will create this key causing the entry to fall off of the report preventing redeployment.

 

Select Top 1000000 tblAssets.AssetID,
  tblAssets.AssetName,
  tsysAssetTypes.AssetTypeIcon10 As icon,
  tblAssets.IPAddress,
  tblAssets.Lastseen,
  tblAssets.Lasttried,
  tblADComputers.OU
From tblAssets
  Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
  Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
  Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Where tblAssets.AssetID Not In (Select tblAssets.AssetID
    From tblAssets Inner Join tblRegistry On tblAssets.AssetID =
          tblRegistry.AssetID
    Where tblRegistry.Regkey Like '%CURRENT%USER%\SOFTWARE\Folder\Folder' And
      tblRegistry.Valuename = 'Key Version' And
      tblRegistry.Value Like '5.5.5') And tblAssets.Lastseen <> '' And
  tblADComputers.OU Like '%OU=Organizational Unit%' And tblAssetCustom.State = 1
Group By tblAssets.AssetID,
  tblAssets.AssetName,
  tsysAssetTypes.AssetTypeIcon10,
  tblAssets.IPAddress,
  tblAssets.Lastseen,
  tblAssets.Lasttried,
  tblADComputers.OU
Order By tblAssets.AssetName

I did generalize certain things like the Key and OU before posting.