Last active
December 7, 2024 12:19
-
-
Save techdecline/53b687b6710dc63eae238303713efed7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aram ( | |
| [Parameter(Mandatory)] | |
| [ValidateScript({Test-Path $_})] | |
| [String]$Source | |
| ) | |
| # Uninstall old releases | |
| Write-Verbose "Searching old TeamViewer releases installed using MSI Wrapper" | |
| $tvArr = Get-WmiObject -Query 'Select Name,IdentifyingNumber from Win32_Product where Name like "TeamViewer%Wrapper%"' | |
| foreach ($tvInstance in $tvArr) { | |
| Write-Verbose "Removing: $($tvInstance.Name) with ID $($tvInstance.IdentifyingNumber)" | |
| $cmdParam = "/x $($tvInstance.IdentifyingNumber) /qn /l*v C:\Windows\Temp\tv_uninstall_$($tvInstance.IdentifyingNumber).txt" | |
| $cmdExe = "msiexec.exe" | |
| Start-Process -FilePath $cmdExe -ArgumentList $cmdParam -Wait | |
| } | |
| # Install TV14 | |
| Write-Verbose "Installing latest TeamViewer Release from source: $Source" | |
| $msiFullName = (Get-ChildItem -Path $Source -Filter *.msi)[0].FullName | |
| $cmdParam = "/i $msiFullName /qn /l*v C:\Windows\Temp\tv_install_$(get-date -Format yyyyMMdd).log" | |
| $cmdExe = "msiexec.exe" | |
| Start-Process -FilePath $cmdExe -ArgumentList $cmdParam -Wait |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #requires -version 2 | |
| param ( | |
| [Parameter(Mandatory=$true)] | |
| [ValidateScript({Test-Path $_})] | |
| [String]$Source | |
| ) | |
| # Uninstall old releases | |
| Write-Verbose "Searching old TeamViewer releases installed using MSI Wrapper" | |
| $tvArr = Get-WmiObject -Query 'Select Name,IdentifyingNumber from Win32_Product where Name like "TeamViewer%Wrapper%"' | |
| foreach ($tvInstance in $tvArr) { | |
| Write-Verbose "Removing: $($tvInstance.Name) with ID $($tvInstance.IdentifyingNumber)" | |
| $cmdParam = "/x $($tvInstance.IdentifyingNumber) /qn /l*v C:\Windows\Temp\tv_uninstall_$($tvInstance.IdentifyingNumber).txt" | |
| $cmdExe = "msiexec.exe" | |
| Start-Process -FilePath $cmdExe -ArgumentList $cmdParam -Wait | |
| } | |
| # Install TV14 | |
| Write-Verbose "Installing latest TeamViewer Release from source: $Source" | |
| $msiFullName = (Get-ChildItem -Path $Source -Filter *.msi).FullName | |
| $cmdParam = "/i $msiFullName /qn /l*v C:\Windows\Temp\tv_install_$(get-date -Format yyyyMMdd).log" | |
| $cmdExe = "msiexec.exe" | |
| Start-Process -FilePath $cmdExe -ArgumentList $cmdParam -Wait |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #requires -version 2 | |
| param ( | |
| [Parameter(Mandatory=$true)] | |
| [ValidateScript({Test-Path $_})] | |
| [String]$Source | |
| ) | |
| # Uninstall old releases | |
| Write-Verbose "Searching old TeamViewer releases installed using MSI Wrapper" | |
| $tvArr = Get-WmiObject -Query 'Select Name,IdentifyingNumber from Win32_Product where Name like "TeamViewer%Wrapper%"' | |
| foreach ($tvInstance in $tvArr) { | |
| Write-Verbose "Removing: $($tvInstance.Name) with ID $($tvInstance.IdentifyingNumber)" | |
| $msiProductCode = ($tvInstance.IdentifyingNumber) -replace "{|}","" | |
| $cmdParam = "/x $msiProductCode /qn /l*v C:\Windows\Temp\tv_uninstall_msiProductCode.txt" | |
| $cmdExe = "msiexec.exe" | |
| Start-Process -FilePath $cmdExe -ArgumentList $cmdParam -Wait | |
| } | |
| # Install TV14 | |
| Write-Verbose "Installing latest TeamViewer Release from source: $Source" | |
| $msiFullName = (Get-ChildItem -Path $Source -Filter *.msi).FullName | |
| $cmdParam = "/i $msiFullName /qn /l*v C:\Windows\Temp\tv_install_$(get-date -Format yyyyMMdd).log" | |
| $cmdExe = "msiexec.exe" | |
| Start-Process -FilePath $cmdExe -ArgumentList $cmdParam -Wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment