Beispielskripte für die Bereitstellung auf mehreren Computern
Im Folgenden finden Sie eine Sammlung von Skripten, die für IT-Administratoren bei der Verwaltung der GoTo-App nützlich sein können. Diese Beispielskripte erleichtern Aufgaben, die nicht automatisch durch Installationsprogramme, Gruppenrichtlinien oder auf andere Weise ausgeführt werden. IT-Administratoren können sie manuell in ihre Skripte integrieren, wenn sie diese Aufgaben ausführen müssen.
GoTo-App pro Benutzer deinstallieren (Windows)
Dieses Skript kann verwendet werden, um die GoTo-App für den aktuellen Benutzer zu deinstallieren. Sie funktioniert nur bei Installationen pro Benutzer. Sie sollte aus dem Benutzerkontext für jedes Benutzerprofil ausgeführt werden, für das die Anwendung deinstalliert werden muss.
<# .SYNOPSIS Dies script prüft, ob die GoTo App für den aktuellen Benutzer installiert ist und, falls ja, deinstalliert sie stillschweigend. .DESCRIPTION Die script prüft, ob die Anwendung läuft und stoppt sie, wenn ja. Es liest dann die Befehlszeile zum Deinstallieren aus dem Eintrag "QuietUninstallString" unter dem Schlüssel "Deinstallieren" für die GoTo App und führt sie aus. #> $ErrorActionPreference = "Stop" Function Stop-App { Param ( [Parameter(Obligatorisch)][String]$AppName ) # Schließt die App, falls sie läuft. $AppProcesses = Get-Process -Name $AppName -ErrorAction SilentlyContinue if ($AppProcesses) { Write-Host "Anhalten von $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" }
Benutzerprofile bereinigen (Windows und Mac)
Dieses Skript kann verwendet werden, um das von der GoTo-App verwendete Benutzerprofil zu bereinigen, nachdem die Anwendung deinstalliert wurde. Die zu bereinigenden Benutzerprofilelemente sind dieselben, unabhängig davon, ob die GoTo-App pro Rechner oder pro Benutzer installiert wurde, aber normalerweise ist dieses Skript nützlich, um nach der Deinstallation pro Rechner aufzuräumen. Das liegt daran, dass bei der MSI-Deinstallation für die Installation pro Maschine die Benutzerprofile nicht bereinigt werden, während bei der Deinstallation pro Benutzer das Benutzerprofil als Teil der Deinstallation bereinigt wird.
Das Skript sollte aus dem Benutzerkontext für jeden Benutzer ausgeführt werden, für den das Profil bereinigt werden muss.
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
Autostart-Einstellung in der Registrierung festlegen oder entfernen (Windows)
Diese Skripte können verwendet werden, um die Autostart-Registrierungseinstellung zu setzen oder zu entfernen, mit der die GoTo-App automatisch gestartet wird, wenn sich der Benutzer anmeldet. Das Skript funktioniert sowohl für die Installation von Anwendungen pro Rechner als auch pro Benutzer, aber die Autostart-Registrierungseinstellung selbst befindet sich in der Benutzerregistrierung(HKCU).
Das Skript sollte aus dem Benutzerkontext für jedes Benutzerprofil ausgeführt werden, für das die Autostarteinstellung gesetzt oder entfernt werden muss.
So legen Sie die Autostart-Registrierungseinstellung fest:
<# .SYNOPSIS Dies script setzt die Autostart-Registrierungseinstellung, die verwendet wird, um automatisch die GoTo Anwendung startet, wenn sich der Benutzer anmeldet. .DESCRIPTION Die script prüft den Installationsordner der Anwendung, sowohl in HKLM als auch in HKCU (es funktioniert sowohl für Installationen von Anwendungen pro Rechner als auch pro Benutzer). Es setzt dann einen "GoTo"Eintrag unter der Taste "Ausführen" für den aktuellen Benutzer. #> $ErrorActionPreference = "Stop" # Lesen Sie die InstallLocation. Versuchen Sie sowohl HKLM als auch 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 "Gefunden GoTo app installiert bei: $instLoc" # Setzen der Autostart-Registrierungseinstellung $regValue = Join-Path -Path $instLoc -ChildPath "GoTo.exe" -Resolve Write-Host "Setzt Autostart-Registrierungseinstellung auf Wert: $regValue" Set-ItemProperty -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "GoTo" -Value $regValue -Type String Write-Host "Done" } else { Write-Host "GoTo app ist nicht installiert" }
So entfernen Sie die Autostart-Registrierungseinstellung:
REM Delete the auto-start setting REG DELETE HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v GoTo /f
Deinstallieren Sie GoTo MSI Versionen 3.17 und niedriger (Windows)
Dieses Skript kann zum Deinstallieren der GoTo MSI-Versionen 3.17 und darunter verwendet werden, die veraltet sind.
Es findet und deinstalliert sowohl Maschinen- als auch Benutzer-MSIs, aber für beide MSI-Typen gibt es unterschiedliche Anforderungen an den Ausführungskontext dieses Skripts. Bitte lesen Sie die Beschreibung des Skripts für weitere Details.
<# .SYNOPSIS Dies script deinstalliert alle MSI Versionen des GoTo/GoToConnect-App Versionen 3.17 und darunter. .DESCRIPTION Die script prüft, ob die Anwendung läuft und stoppt sie, wenn ja. Dann sucht es nach MSI Paketen mit dem UpgradeCode, der von MSI Versionen 3.17 und niedriger verwendet werden, und deinstalliert sie. Die Maschine MSI erfordert Administratorrechte, um deinstalliert zu werden, also führen Sie dieses script von einem Administrator-Konto aus, um die Maschine zu deinstallieren MSI. Da der Benutzer MSI auf der Benutzerebene installiert ist, sollte dieses script in dem Benutzerkontext ausgeführt werden, in dem der Benutzer MSI installiert hat. #> $ErrorActionPreference = "Stop" # Dies ist der UpgradeCode für: # - MSI Versionen 3.17 und darunter, sowohl für den User- als auch für den Machine MSI Installationsprogramme # - MSI Versionen 3.18 und höher, nur für die MSI für die Installation pro Maschine $UpgradeCode = "{147165DC-20D5-5870-9653-1A02A52D396F}" # MSI Versionen unterhalb dieser Version werden deinstalliert $UninstallVersionsBelow = [System.Version]::Parse("3.18") Function Stop-App { Param ( [Parameter(Obligatorisch)][String]$AppName ) # Schließt die App, falls sie läuft. $AppProcesses = Get-Process -Name $AppName -ErrorAction SilentlyContinue if ($AppProcesses) { Write-Host "Anhalten von $AppName app..." Stop-Process -Name $AppName -Force # Ein bisschen warten Start-Sleep -Seconds 5 } else { Write-Host "$AppName app is not running" } # Prüfen, ob die App noch läuft $AppProcesses = Get-Process -Name $AppName -ErrorAction SilentlyContinue if ($AppProcesses) { Write-Host "$AppName app is still running, aborting" Exit 1 } } # Die App wurde aufgerufen GoToConnect in älteren Versionen. Make sure both the GoTo and GoToConnect apps are not running Stop-App -AppName GoTo Stop-App -AppName GoToConnect $AllProps = Get-CimInstance -Class Win32_Property # Get an array of product codes with the matching upgrade code $ProductCodes = @(($AllProps | Where-Object {$_.Property -eq "UpgradeCode" -and $_.Value -eq $UpgradeCode}).ProductCode) if (!$ProductCodes) { Write-Host "No installed MSIs found with the specified UpgradeCode $UpgradeCode" } else { Write-Host "Found $($ProductCodes.Length) MSI(s) installed with the specified UpgradeCode $UpgradeCode`n" foreach ($ProductCode in $ProductCodes) { # Obtain the ProductName and ProductVersion of the current ProductCode $ProductName = ($AllProps | Where-Object {$_.Property -eq "ProductName" -and $_.ProductCode -eq $ProductCode}).Value $ProductVersion = ($AllProps | Where-Object {$_.Property -eq "ProductVersion" -and $_.ProductCode -eq $ProductCode}).Value Write-Host "ProductName: $ProductName ProductVersion: $ProductVersion ProductCode: $ProductCode" try { $ProductVersionParsed = [System.Version]::Parse($ProductVersion) if ($ProductVersionParsed -lt $UninstallVersionsBelow) { Write-Host "`tProductVersion below threshold, uninstalling..." # msiexec.exe starten, um den aktuellen ProductCode zu deinstallieren $MSIArguments = @( "/x" $ProductCode "/qn" "/norestart" ) $Process = Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow -PassThru # Exit-Code von msiexec.exe prüfen if ($Process.ExitCode -eq 0) { Write-Host "`tCompleted." } else { Write-Host "`tDeinstallieren fehlgeschlagen - msiexec.exe Exit Code $($Process.ExitCode)." } } else { Write-Host "`tProductVersion zu hoch, wird nicht deinstalliert" } } catch { Write-Host "`tKonnte nicht geparst werden ProductVersion '$ProductVersion'" } } }