Sample scripts when deploying to multiple computers
Below you will find a collection of scripts that IT administrators may find useful in managing the GoTo app. These sample scripts facilitate tasks that are not performed automatically by installers, Group Policies, or otherwise. IT administrators can manually integrate them into their scripts if they need to perform these tasks.
Uninstall GoTo app per-user installation (Windows)
This script can be used to uninstall the GoTo app for the current user. It works on per-user installations only. It should be executed from the user context for each user profile, for which the app needs to be uninstalled.
<#
.SYNOPSIS
This script checks if the GoTo app is installed for the current user and, if so, uninstalls it silently.
.DESCRIPTION
The script checks if the app is running and stops it if so.
It then reads the uninstall command line from the "QuietUninstallString" entry under the "Uninstall" key
for the GoTo app and executes it.
#>
$ErrorActionPreference = "Stop"
Function Stop-App {
Param (
[Parameter(Mandatory)][String]$AppName
)
# Close the app, if running.
$AppProcesses = Get-Process -Name $AppName -ErrorAction SilentlyContinue
if ($AppProcesses) {
Write-Host "Stopping $AppName app..."
Stop-Process -Name $AppName -Force
# Wait a bit
Start-Sleep -Seconds 5
} else {
Write-Host "$AppName app is not running"
}
# Check that the app is not still running
$AppProcesses = Get-Process -Name $AppName -ErrorAction SilentlyContinue
if ($AppProcesses) {
Write-Host "$AppName app is still running, aborting"
Exit 1
}
}
# Make sure the GoTo app is not running
Stop-App -AppName GoTo
# Read the QuietUninstallString
try {
$UninstStr = Get-ItemPropertyValue -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\b5746384-3503-4fbf-824a-0a42d1bd0639" -Name "QuietUninstallString"
} catch {
$UninstStr = $null
}
if ($UninstStr) {
# Optionally, preserve the user profile
# $UninstStr = "$UninstStr --KeepProfile"
Write-Host "Found GoTo app installed, uninstalling using command: $UninstStr"
# Uninstall app
$Process = Start-Process -FilePath "$Env:ComSpec" -ArgumentList "/c $UninstStr" -PassThru
$Process.WaitForExit()
Write-Host "Done"
} else {
Write-Host "GoTo app is not installed"
}
Clean up user profiles (Windows and Mac)
This script can be used to clean up the user profile used by the GoTo app after the app is uninstalled. The user profile items to clean up are the same regardless of whether GoTo app was installed per machine or per user, but normally this script is useful to clean up after per-machine uninstall. This is because uninstalling the MSI for per-machine installation does not clean up the user profiles, while the per-user uninstall cleans up the user profile as part of the uninstallation.
The script should be executed from the user context for each user, for which the profile needs to be cleaned up.
Windows
REM Delete the app registry key
REG DELETE HKEY_CURRENT_USER\Software\LogMeInInc\GoTo /f
REM Delete the auto-start setting
REG DELETE HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v GoTo /f
REM Delete the app data folder
RMDIR /S /Q "%APPDATA%\GoTo"
Mac
# Delete the plist
rm -f ~/Library/Preferences/com.logmein.goto.plist
# Delete the app data folder
rm -rf ~/Library/Application\ Support/GoTo
Set or remove auto-start registry setting (Windows)
These scripts can be used to set or remove the auto-start registry setting used to automatically start the GoTo app when the user logs in. The script works for both per-machine and per-user app installations, but the auto-start registry setting itself is in the user registry (HKCU).
The script should be executed from the user context for each user profile, for which the auto-start setting needs to be set or removed.
To set the auto-start registry setting:
<#
.SYNOPSIS
This script sets the auto-start registry setting used to automatically start the GoTo app when the user
logs in.
.DESCRIPTION
The script checks the installation folder of the app, in both HKLM and HKCU (it works for both per-machine
and per-user app installations). It then sets a "GoTo" entry under the "Run" key for the current user.
#>
$ErrorActionPreference = "Stop"
# Read the InstallLocation. Try both HKLM and HKCU
try {
$instLoc = Get-ItemPropertyValue -LiteralPath "HKLM:\Software\LogMeInInc\GoTo\ElectronInstallDetails" -Name "InstallLocation"
} catch {
try {
$instLoc = Get-ItemPropertyValue -LiteralPath "HKCU:\Software\LogMeInInc\GoTo\ElectronInstallDetails" -Name "InstallLocation"
} catch {
$instLoc = $null
}
}
if ($instLoc -ne $null) {
Write-Host "Found GoTo app installed at: $instLoc"
# Set the auto-start registry setting
$regValue = Join-Path -Path $instLoc -ChildPath "GoTo.exe" -Resolve
Write-Host "Setting auto-start registry setting to value: $regValue"
Set-ItemProperty -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "GoTo" -Value $regValue -Type String
Write-Host "Done"
} else {
Write-Host "GoTo app is not installed"
}
To remove the auto-start registry setting:
REM Delete the auto-start setting
REG DELETE HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v GoTo /f