Logo



Follow

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 script to get rid of both DDPortal and the folder. 

Thanks to Darren Kattan from Immense Networks for the script.

 

# 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'"
}