Skip to main content

Import - Remote Monitor - Uninstall VLC Player

Step 1

Ensure the presence of the CWM - Automate - Script - Ticket Creation - Computer script and the △ Custom - Ticket Creation - Computer alert template.

Step 2

Obtain the group ID(s) of the group(s) that the remote monitor should be applied to.

Step 3

Copy the following query and replace YOUR COMMA SEPARATED LIST OF GROUPID(S) with the Group ID(s) of the relevant groups:
(The string to replace can be found at the very bottom of the query, right after WHERE)

INSERT INTO groupagents 
SELECT '' as `AgentID`,
`groupid` as `GroupID`,
'0' as `SearchID`,
'ProVal - Dev - Uninstall VLC Player' as `Name`,
'6' as `CheckAction`,
'1' as `AlertAction`,
'VLC Removal Failed - %COMPUTERNAME%~~~Successfully removed VLC Player!!!VLC Removal Failed - %COMPUTERNAME%~~~Failed to remove VLC Player for %COMPUTERNAME%. Please review.' as `AlertMessage`,
'0' as `ContactID`,
'604800' as `interval`,
'127.0.0.1' as `Where`,
'7' as `What`,
'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -Command "$US = (Get-ChildItem -Path HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall, HKLM:\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -Match \'VLC Media Player\' }).UninstallString; if($US) { foreach ($U in $US) {cmd.exe /c $U /S /V /qn }; $US = (Get-ChildItem -Path HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall, HKLM:\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -Match \'VLC Media Player\' }).UninstallString; if($US) { return \'Failed to remove VLC.\' } else {return \'Successfully removed VLC.\'}} else {return \'VLC player is not installed.\'}"' as `DataOut`,
'9' as `Comparor`,
'Failed to remove VLC' as `DataIn`,
'' as `IDField`,
'1' as `AlertStyle`,
'0' as `ScriptID`,
'' as `datacollector`,
'21' as `Category`,
'0' as `TicketCategory`,
'1' as `ScriptTarget`,
UUID() as `GUID`,
'root' as `UpdatedBy`,
(NOW()) as `UpdateDate`
FROM mastergroups m
WHERE m.groupid IN (YOUR COMMA SEPARATED LIST OF GROUPID(S))
AND m.groupid NOT IN (SELECT DISTINCT groupid FROM groupagents WHERE `Name` = 'ProVal - Dev - Uninstall VLC Player')

Step 4

An example of a query with a group ID:

INSERT INTO groupagents 
SELECT '' as `AgentID`,
`groupid` as `GroupID`,
'0' as `SearchID`,
'ProVal - Dev - Uninstall VLC Player' as `Name`,
'6' as `CheckAction`,
'1' as `AlertAction`,
'VLC Removal Failed - %COMPUTERNAME%~~~Successfully removed VLC Player!!!VLC Removal Failed - %COMPUTERNAME%~~~Failed to remove VLC Player for %COMPUTERNAME%. Please review.' as `AlertMessage`,
'0' as `ContactID`,
'604800' as `interval`,
'127.0.0.1' as `Where`,
'7' as `What`,
'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -Command "$US = (Get-ChildItem -Path HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall, HKLM:\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -Match \'VLC Media Player\' }).UninstallString; if($US) { foreach ($U in $US) {cmd.exe /c $U /S /V /qn }; $US = (Get-ChildItem -Path HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall, HKLM:\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -Match \'VLC Media Player\' }).UninstallString; if($US) { return \'Failed to remove VLC.\' } else {return \'Successfully removed VLC.\'}} else {return \'VLC player is not installed.\'}"' as `DataOut`,
'9' as `Comparor`,
'Failed to remove VLC' as `DataIn`,
'' as `IDField`,
'1' as `AlertStyle`,
'0' as `ScriptID`,
'' as `datacollector`,
'21' as `Category`,
'0' as `TicketCategory`,
'1' as `ScriptTarget`,
UUID() as `GUID`,
'root' as `UpdatedBy`,
(NOW()) as `UpdateDate`
FROM mastergroups m
WHERE m.groupid IN (2,856)
AND m.groupid NOT IN (SELECT DISTINCT groupid FROM groupagents WHERE `Name` = 'ProVal - Dev - Uninstall VLC Player')

Step 5

Now execute your query from a RAWSQL monitor set.

Step 6

Locate your remote monitor by opening the group(s) remote monitors tab, then apply the △ Custom - Ticket Creation - Computer alert template.