#msiexec /uninstall "{19A62C3B-3907-4CC0-B037-DFC883A347B3}" /q #msiexec /uninstall "{D1607BEA-A9DC-449A-B7A5-770492376485}" /q $Service = Get-Service -DisplayName "TSM Client Scheduler" -ErrorAction SilentlyContinue If ($Service) { Write-Warning "Stop TSM Client Scheduler service" Get-Service -DisplayName "TSM Client Scheduler" | Stop-Service Write-Warning "Remove TSM Client Scheduler service with dsmcutil" $ServiceRemoval1 = Invoke-Expression -Command '& "C:\Program Files\Tivoli\TSM\baclient\dsmcutil.exe" remove /name:"TSM Client Scheduler"' $ServiceRemoval2 = Invoke-Expression -Command '& "C:\Program Files\Tivoli\TSM\baclient\dsmcutil.exe" remove /name:"ISP Client Scheduler"' If ($ServiceRemoval1 -match "The service was successfully removed." -or $ServiceRemoval2 -match "The service was successfully removed.") { Write-Warning "TSM Client Scheduler service successfully removed" } Else { Write-Error "TSM service removal error" -ErrorAction Stop } } $TSMGuids = @( "{2068FA80-E4DD-4F9D-AD94-AAF8AAB62142}", "{F2299C3C-F4D2-4151-AD79-DBAB8DF7DBE6}", "{89857B75-F612-49B8-83E4-081C4D8D2A2F}", "{00F61113-3426-49C2-AFAF-E0ECDA4CF352}", "{C04EDECE-BA6C-4E0D-9959-D30C5485316F}", "{0EE10C4C-D8EC-48BA-A4B3-C05A5D660395}", "{19A62C3B-3907-4CC0-B037-DFC883A347B3}", "{D1F5E133-94F4-4BCE-95DD-656DD4E04B56}", "{2724D1FA-B655-4EA2-A1AF-C6D2C4630F46}", "{5A9BA69C-B7E8-49AC-8ACA-A4B1B7A1652F}", "{66869291-1627-46DF-969C-57B10EBEA7DE}", "{25A8256B-EB72-4DA5-87CB-0CBB52B8B37B}", "{5B310A44-6A5B-41DB-964F-49D2292CE5F4}", "{D1607BEA-A9DC-449A-B7A5-770492376485}", "{6E2D5C0A-E7AC-4AA2-8C0B-1738E86C0142}" ) $Service = Get-Service -DisplayName "TSM Client Scheduler" -ErrorAction SilentlyContinue If ($Service) { Write-Error "TSM service still exists error" -ErrorAction Stop } Else { Write-Warning "Discover TSM installed apps" Write-Warning "Start TSM Removal Loop" ForEach ($Guid in $TSMGuids) { Write-Warning "Removing $Guid" $params = @{ "FilePath" = "C:\windows\system32\msiexec.exe" "ArgumentList" = @( "/uninstall" "$Guid" "/q" ) "Verb" = "runas" "PassThru" = $true } $uninstaller = start-process @params $uninstaller.WaitForExit() } } <# $uninstaller = start-process @params $uninstaller.WaitForExit() Write-Warning "End TSM JVM Removal" Write-Warning "Start TSM Client Removal" $params = @{ "FilePath" = "C:\windows\system32\msiexec.exe" "ArgumentList" = @( "/uninstall" "{D1607BEA-A9DC-449A-B7A5-770492376485}" "/q" ) "Verb" = "runas" "PassThru" = $true } $uninstaller = start-process @params $uninstaller.WaitForExit() Write-Warning "End TSM Client Removal" #>