Add teamviewer windows FMA (#27651)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# Learn more about .exe install scripts:
|
||||
# http://fleetdm.com/learn-more-about/exe-install-scripts
|
||||
|
||||
$exeFilePath = "${env:INSTALLER_PATH}"
|
||||
|
||||
try {
|
||||
|
||||
# Add argument to install silently
|
||||
# Argument to make install silent depends on installer,
|
||||
# each installer might use different argument (usually it's "/S" or "/s")
|
||||
$processOptions = @{
|
||||
FilePath = "$exeFilePath"
|
||||
ArgumentList = "/S"
|
||||
PassThru = $true
|
||||
Wait = $true
|
||||
}
|
||||
|
||||
# Start process and track exit code
|
||||
$process = Start-Process @processOptions
|
||||
$exitCode = $process.ExitCode
|
||||
|
||||
# Prints the exit code
|
||||
Write-Host "Install exit code: $exitCode"
|
||||
Exit $exitCode
|
||||
|
||||
} catch {
|
||||
Write-Host "Error: $_"
|
||||
Exit 1
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
# Define acceptable/expected exit codes
|
||||
$ExpectedExitCodes = @(0)
|
||||
|
||||
# Uninstall Registry Key
|
||||
$machineKey = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\TeamViewer'
|
||||
|
||||
# Additional uninstall args
|
||||
$uninstallArgs = "/S"
|
||||
|
||||
# Initialize exit code
|
||||
$exitCode = 0
|
||||
|
||||
try {
|
||||
$key = Get-ItemProperty -Path $machineKey -ErrorAction Stop
|
||||
|
||||
# Get the uninstall command. Some uninstallers do not include 'QuietUninstallString'
|
||||
$uninstallCommand = if ($key.QuietUninstallString) {
|
||||
$key.QuietUninstallString
|
||||
} else {
|
||||
$key.UninstallString
|
||||
}
|
||||
|
||||
# The uninstall command may contain command and args, like:
|
||||
# "C:\Program Files\Software\uninstall.exe" --uninstall --silent
|
||||
# Split the command and args
|
||||
$splitArgs = $uninstallCommand.Split('"')
|
||||
if ($splitArgs.Length -gt 1) {
|
||||
if ($splitArgs.Length -eq 3) {
|
||||
$uninstallArgs = "$( $splitArgs[2] ) $uninstallArgs".Trim()
|
||||
} elseif ($splitArgs.Length -gt 3) {
|
||||
Throw "Uninstall command contains multiple quoted strings. Please update the uninstall script.`nUninstall command: $uninstallCommand"
|
||||
}
|
||||
$uninstallCommand = $splitArgs[1]
|
||||
}
|
||||
|
||||
Write-Host "Uninstall command: $uninstallCommand"
|
||||
Write-Host "Uninstall args: $uninstallArgs"
|
||||
|
||||
$processOptions = @{
|
||||
FilePath = $uninstallCommand
|
||||
PassThru = $true
|
||||
Wait = $true
|
||||
}
|
||||
if ($uninstallArgs -ne '') {
|
||||
$processOptions.ArgumentList = "$uninstallArgs"
|
||||
}
|
||||
|
||||
# Start uninstall process
|
||||
$process = Start-Process @processOptions
|
||||
$exitCode = $process.ExitCode
|
||||
Write-Host "Uninstall exit code: $exitCode"
|
||||
|
||||
} catch {
|
||||
Write-Host "Error: $_"
|
||||
$exitCode = 1
|
||||
}
|
||||
|
||||
# Treat acceptable exit codes as success
|
||||
if ($ExpectedExitCodes -contains $exitCode) {
|
||||
Exit 0
|
||||
} else {
|
||||
Exit $exitCode
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "TeamViewer",
|
||||
"slug": "teamviewer/windows",
|
||||
"package_identifier": "TeamViewer.TeamViewer",
|
||||
"unique_identifier": "TeamViewer",
|
||||
"install_script_path": "ee/maintained-apps/inputs/winget/scripts/teamviewer_install.ps1",
|
||||
"uninstall_script_path": "ee/maintained-apps/inputs/winget/scripts/teamviewer_uninstall.ps1",
|
||||
"installer_arch": "x64",
|
||||
"installer_type": "exe",
|
||||
"installer_scope": "machine"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"version": "15.64.3",
|
||||
"queries": {
|
||||
"exists": "SELECT 1 FROM programs WHERE name = 'TeamViewer' AND publisher = 'TeamViewer';"
|
||||
},
|
||||
"installer_url": "https://download.teamviewer.com/download/version_15x/TeamViewer_Setup_x64_15.64.3.exe",
|
||||
"unique_identifier": "TeamViewer",
|
||||
"install_script_ref": "45f422bf",
|
||||
"uninstall_script_ref": "390c83e7",
|
||||
"sha256": "2a8aefd4f2e4a44c3f7c55caa35d61827e37392fe72726b9a980299f9199a230"
|
||||
}
|
||||
],
|
||||
"refs": {
|
||||
"390c83e7": "# Define acceptable/expected exit codes\n$ExpectedExitCodes = @(0)\n\n# Uninstall Registry Key\n$machineKey = 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\TeamViewer'\n\n# Additional uninstall args\n$uninstallArgs = \"/S\"\n\n# Initialize exit code\n$exitCode = 0\n\ntry {\n $key = Get-ItemProperty -Path $machineKey -ErrorAction Stop\n\n # Get the uninstall command. Some uninstallers do not include 'QuietUninstallString'\n $uninstallCommand = if ($key.QuietUninstallString) {\n $key.QuietUninstallString\n } else {\n $key.UninstallString\n }\n\n # The uninstall command may contain command and args, like:\n # \"C:\\Program Files\\Software\\uninstall.exe\" --uninstall --silent\n # Split the command and args\n $splitArgs = $uninstallCommand.Split('\"')\n if ($splitArgs.Length -gt 1) {\n if ($splitArgs.Length -eq 3) {\n $uninstallArgs = \"$( $splitArgs[2] ) $uninstallArgs\".Trim()\n } elseif ($splitArgs.Length -gt 3) {\n Throw \"Uninstall command contains multiple quoted strings. Please update the uninstall script.`nUninstall command: $uninstallCommand\"\n }\n $uninstallCommand = $splitArgs[1]\n }\n\n Write-Host \"Uninstall command: $uninstallCommand\"\n Write-Host \"Uninstall args: $uninstallArgs\"\n\n $processOptions = @{\n FilePath = $uninstallCommand\n PassThru = $true\n Wait = $true\n }\n if ($uninstallArgs -ne '') {\n $processOptions.ArgumentList = \"$uninstallArgs\"\n }\n\n # Start uninstall process\n $process = Start-Process @processOptions\n $exitCode = $process.ExitCode\n Write-Host \"Uninstall exit code: $exitCode\"\n\n} catch {\n Write-Host \"Error: $_\"\n $exitCode = 1\n}\n\n# Treat acceptable exit codes as success\nif ($ExpectedExitCodes -contains $exitCode) {\n Exit 0\n} else {\n Exit $exitCode\n}\n",
|
||||
"45f422bf": "# Learn more about .exe install scripts:\n# http://fleetdm.com/learn-more-about/exe-install-scripts\n\n$exeFilePath = \"${env:INSTALLER_PATH}\"\n\ntry {\n\n# Add argument to install silently\n# Argument to make install silent depends on installer,\n# each installer might use different argument (usually it's \"/S\" or \"/s\")\n$processOptions = @{\n FilePath = \"$exeFilePath\"\n ArgumentList = \"/S\"\n PassThru = $true\n Wait = $true\n}\n \n# Start process and track exit code\n$process = Start-Process @processOptions\n$exitCode = $process.ExitCode\n\n# Prints the exit code\nWrite-Host \"Install exit code: $exitCode\"\nExit $exitCode\n\n} catch {\n Write-Host \"Error: $_\"\n Exit 1\n}\n"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user