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 and the folder.

Thanks to Darren Kattan from Immense Networks for the 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. Update the $applicationName variable to match your DD Portal Installer name (This can be found on your Admin Console under Desktop Installer)
  2. To test the script runs successfully, use the green Play arrow available on the Powershell ISE interface.
  3. If this tests successfully, save this script as a .PS1 file. You can call this script using your preferred RMM Tool.

Script Reference

# Uninstall Desk Director

# Your application names here
$applicationName = "DDPortal"

$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 "$applicationName*Machine*"}

$ProgramsToUninstall | %{
$Program = $_
$UninstallString = $Program.UninstallString.Replace("/I","/X") + " /qn"
iex "cmd /c '$UninstallString'"

How did we do?