Uninstalling the PDQ Inventory Agent

Purpose:

You wish to remove the discontinued PDQ Inventory Agent from the computers in your environment.

Background:

Due to issues with stability, performance, and reliability, we have discontinued the PDQ Inventory Agent. All services related to the Agent have been shut down and all Agent-related code and features have been removed from PDQ Deploy and PDQ Inventory beginning in version 18.3.2.0. More information about the reasons for the removal of the Agent can be found in the following article: PDQ Agent Status Update

Resolution:

The option to uninstall the Agent is no longer available when right-clicking on a computer in PDQ Inventory, but we have included two new methods to uninstall the Agent from any computers which still have it.

Method 1:

The first method is to use the Uninstall PDQ Agent package that is available in the Uninstalls section of PDQ Deploy's Package Library shown here:

mceclip3.png

This package can be downloaded from the Package Library and deployed to your endpoints to remove the PDQ Agent. 

Method 2:

If you don't have PDQ Deploy or would prefer to use PDQ Inventory, you can create a custom tool to uninstall the Agent. To do this, go to the Tools section in PDQ Inventory and right-click in the Tools Menu, then select "Tool":

mceclip1.png

This will open a new tool in edit mode. Change the Run Type to Remote from the Run Type drop-down menu, set the Command type to PowerShell, and paste the following script into the command box.

$AppName = "PDQ Inventory Agent"
$Publisher = "PDQ.com"
foreach ($Architecture in "SOFTWARE", "SOFTWARE\Wow6432Node") {
$UninstallKeys = "HKLM:\$Architecture\Microsoft\Windows\CurrentVersion\Uninstall"
if (Test-path $UninstallKeys) {
Write-Output "Checking for $AppName in $UninstallKeys"
$AgentInstallation = Get-ItemProperty -Path "$UninstallKeys\*" |
Where-Object {$_.DisplayName -eq $AppName -and $_.Publisher -eq $Publisher}
$AgentInstallations += $AgentInstallation
}
}

If($AgentInstallations){
$AgentInstallations | ForEach-Object{
Stop-Service "PDQ Inventory Agent" -Force
Start-Sleep 5
Write-Output "Uninstalling $($_.DisplayName) - $($_.PSChildName)"
Start-Process -Wait -FilePath "MsiExec.exe" -ArgumentList "/X $($_.PSChildName) /qn /norestart"
}
}
Else{
Write-Output "No installations of $AppName found."
}

$AgentPaths = "$env:ProgramData\Admin Arsenal\PDQ Inventory Agent", "$env:ProgramFiles\Admin Arsenal\PDQ Inventory Agent", "${env:ProgramFiles(x86)}\Admin Arsenal\PDQ Inventory Agent", "$env:windir\AdminArsenal\InstallAgentStep"
foreach ($Path in $AgentPaths){
if (Test-Path $Path) {
Write-Output "Removing directory $Path"
Remove-Item -Path $Path -Recurse
}
}

$RegistryPath = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PDQInventoryAgent"

if (Test-Path $RegistryPath) {
Write-Output "Removing registry key $RegistryPath"
Remove-Item -Path $RegistryPath -Recurse
}

Set the tool to scan the computer after it runs, and change the scan profile to Applications so that Inventory recognizes the removal of the Agent in the computer's Applications table. The finished tool should look like this:

 mceclip0.png

 You can also import this tool into PDQ Inventory by downloading the file attached at the bottom of this article then right-clicking in the Tools menu and selecting "Import".

 

Still have a question or want to share what you have learned? Visit our Community to get help and collaborate with others.