Uninstall Script for DDPortal

Uninstalling DD Portal without the use of a script tends to leave a folder in the user's `C:\Users\username\AppData\Local\deskdirectorportal` . If installing the portal again with the MSI, the MSI looks to see if the folder exists, if it does, it assumes the portal has already been installed. You must delete this folder manually to get the MSI to run and install DDPortal again.

Alternatively, you can use the following PowerShell script as an Administrator to get rid of both DDPortal & associated folders as well as the MSI installer / updater.

This script finds all copies of the application across user profiles, and removes it, as well as the MSI installer / update application from Program Files. The user you execute this script as must have administrative privileges as it removes entries from the registry as well as files from the Program Files directory and multiple user profiles.

Thanks to Darren Kattan from Immense Networks for the original script.

Preparing the Powershell Script 

Run Windows Powershell ISE as Administrator

Copy the script from the Script Reference section at the bottom of this article into Powershell ISE

  1. To test the script runs successfully, use the green Play arrow available on the Powershell ISE interface.
  2. If this tests successfully, save this script as a .PS1 file. You can call this script using your preferred RMM Tool.

Script Reference

$ProfileList = ('hklm:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' | gci -ErrorAction SilentlyContinue | Get-ItemProperty -ErrorAction SilentlyContinue )
$Paths = ($ProfileList | ?{$_.PSChildName.Length -gt 10} | %{$_.ProfileImagePath})
$Executables = @()
$Paths | %{
$Path = $_
$LocalAppData = $Path + "\AppData\Local\deskdirectorportal"
$RoamingAppData = $Path + "\AppData\Roaming\DeskDirector Portal"
if((Test-Path $LocalAppData) -and (Test-Path $RoamingAppData))
{
$Executables += dir $LocalAppData | ?{$_.PSIsContainer -and $_.name -like 'app-*'} | %{ dir $_.FullName *.exe }
}
$ExecutableNames = $Executables | Group Name | %{$_.Name}
$ExecutableNames | %{
taskkill /IM $_ /F 2>&1 | Out-Null
}
$updateExe = $LocalAppData + "\Update.exe"
$uninstallParams = "--uninstall -s".Split("")
if(Test-Path $updateExe) {
&"$updateExe" $uninstallParams | echo "Waiting"
}
Remove-Item $LocalAppdata -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $RoamingAppData -Recurse -Force -ErrorAction SilentlyContinue
}
$ProgramsToUninstall = 'hklm:/Software/Microsoft/Windows/CurrentVersion/Uninstall','hklm:/Software/WOW6432Node/Microsoft/Windows/CurrentVersion/Uninstall' | gci -ErrorAction SilentlyContinue | Get-ItemProperty -ErrorAction SilentlyContinue | ?{$_.DisplayName -like "*Machine-Wide*"}
$ProgramsToUninstall | %{
$Program = $_
$UninstallString = $Program.UninstallString.Replace("/I","/X") + " /qn"
iex "cmd /c '$UninstallString'"
}

How did we do?

Antivirus Issues

DD Portal for Windows: LabTech Deployment Guide

Contact