→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !

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


https://www.lansweeper.com/forum/yaf_postst17753findunread_check-if-process-is-running-report.aspx#post59508

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!
1 REPLY 1
RCorbeil
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
tblAssets.AssetName
From
tblAssets
Where
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