→ The Lansweeper Customer Excellence Awards 2024 - Submit Your Project Now! Learn More & Enter Here

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jaywill80
Engaged Sweeper
Created a report to query on all assets that are missing a specified registry key - how can I scope this down to just query back on laptops in an OU that missing the registry value?

Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblAssets.Username
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where tblAssets.AssetID Not In (Select tblAssets.AssetID
From tblAssets Inner Join tblRegistry On tblAssets.AssetID =
tblRegistry.AssetID
Where tblRegistry.Regkey Like '%SOFTWARE\gppreauth' And
tblRegistry.Valuename = 'Expires') And tsysAssetTypes.AssetTypename =
'windows' And tblAssets.Lastseen <> '' And tblAssetCustom.State = 1
2 REPLIES 2
jaywill80
Engaged Sweeper
Thanks works great!
Esben_D
Lansweeper Employee
Lansweeper Employee
To used your query and added some table to just filter on laptops and OU. For the laptops I added "tblPortableBattery.AssetID Is Not Null". Since only laptops will have a portable battery, this must have a value for the asset to be a laptop.

For the OU filter I added tblADComputers.OU. You will have to add the OU by replacing the highlighted code below.

Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblAssets.Username
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblPortableBattery
On tblAssets.AssetID = tblPortableBattery.AssetID
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 '%SOFTWARE\gppreauth' And
tblRegistry.Valuename = 'Expires') And tsysAssetTypes.AssetTypename =
'windows' And tblAssets.Lastseen <> '' And tblAssetCustom.State = 1 And
tblPortableBattery.AssetID Is Not Null And tblADComputers.OU = 'Your OU'

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now