Notification

Icon
Error

Change processes report to show opposite results - Trying to get all PCs w/o this running process

Posted: Monday, June 29, 2020 7:43:28 PM(UTC)
William382

William382

Member Original PosterPosts: 28
0
Like
I found the below script in the forum:
Quote:
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.c...ng-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!
RC62N
#1RC62N Member Posts: 562  
posted: 6/29/2020 9:38:46 PM(UTC)
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:
Code:
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".

Active Discussions

Lansweeper try to scan for software license and not working?
by  rader   Go to last post Go to first unread
Last post: Today at 4:25:37 PM(UTC)
Lansweeper LsAgent uninstalled itself (Windows 10 Enterprise)
by  LsUsers70  
Go to last post Go to first unread
Last post: Today at 3:05:37 PM(UTC)
Lansweeper Deploying PowerShell script
by  FreddieIT   Go to last post Go to first unread
Last post: Today at 10:57:34 AM(UTC)
Lansweeper Deploy package - add registry key to HKCU
by  Bginchereau  
Go to last post Go to first unread
Last post: Yesterday at 5:26:16 PM(UTC)
Lansweeper Duplicate Items
by  Tim Van Engeland   Go to last post Go to first unread
Last post: Yesterday at 2:46:32 PM(UTC)
Lansweeper Latest LsAgent version for Windows?
by  mg83  
Go to last post Go to first unread
Last post: Yesterday at 11:07:51 AM(UTC)
Lansweeper Exchange scanning
by  brama   Go to last post Go to first unread
Last post: Yesterday at 8:56:01 AM(UTC)