I was looking for some assistance with some code I've been working on, which has been designed to check your current OS architecture, and to run the relevant uninstaller for TeamViewer depending on the values returned...
Please forgive my basic Powershell knowledge, but I've knocked together the below, and I'm getting the following error: Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
It's almost like if it can't find the initial uninstaller, then the code stops.
if ((gwmi win32_operatingsystem | select osarchitecture).osarchitecture -eq "64-bit")
{
#64 bit TeamViewer Uninstall
Start-Process -FilePath "C:\Program Files\TeamViewer\uninstall.exe"
$StartTVUninstaller = New-Object -ComObject wscript.shell;
Sleep 2
$StartTVUninstaller.SendKeys('~')
Sleep 10
$StartTVUninstaller.SendKeys('%{F4}')
sleep 2
Stop-Process -name Un_A
}
else
{
#32 bit TeamViewer Uninstall
Start-Process -Filepath "-file C:\Program Files (x86)\TeamViewer\uninstall.exe"
$StartTVUninstaller_32 = New-Object -ComObject wscript.shell;
Sleep 2
$StartTVUninstaller_32.SendKeys('~')
Sleep 10
$StartTVUninstaller_32.SendKeys('%{F4}')
sleep 2
Stop-Process -name Un_A
}
Ignore the 'SendKeys' elements for now, this is more for when the Uninstaller has launched and will attempt to make the uninstallation process seemless.
The reason this is being done this way, is due to TeamViewer being deployed en masse using the executable, and not a custom packaged MSI.
Hopefully someone can point me in the right direction.