Showing results for 
Show  only  | Search instead for 
Did you mean: 
Engaged Sweeper III
I found the below script in the forum:
Select Top 1000 tblAssets.AssetName,
From tblAssets
Inner Join tblProcesses On tblAssets.AssetID = tblProcesses.AssetID
Where tblProcesses.Caption = 'OneDrive.exe'

I want to change it to where I can see any PCs NOT running OneDrive. I'm trying to get certainty this process is running org wide and ensure it sends a weekly email if we have some down. You know, for syncing stuff.

I tried modifying the last line with a NOT, but that didn't work. How can I make this show only PC without this process.
Where NOT tblProcesses.Caption = 'OneDrive.exe'
I could do a compare column in excel with what the output is of the above, but I'd like to all canned up nicely in a report.

Thank you!
Honored Sweeper II
You've run into a "do what I mean, not what I say" situation. By NOT-ing your WHERE condition, you're basically saying "show me everything except OneDrive.exe".

Try this instead:
Select Top 1000
NOT EXISTS (SELECT tblProcesses.AssetID
FROM tblProcesses
WHERE tblProcesses.Caption = 'OneDrive.exe'
AND tblProcesses.AssetID = tblAssets.AssetID)

If you remove the NOT on this, it should return the same asset list as your original query.

In this case, the sub-SELECT is pulling a list of assets that include the OneDrive.exe process, then the main SELECT is saying "show me a list of assets that aren't in that list".

New to Lansweeper?

Try Lansweeper For Free

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

Try Now