Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Vendor = "TeamViewer"
- $Prodcut = "TeamViewer"
- $ProductGUID = (get-wmiobject Win32_Product | Sort-Object -Property Name | Where-Object Vendor -match $Vendor).IdentifyingNumber
- (get-process | ? { $_.mainwindowtitle -ne "" -and $_.processname -eq "$Prodcut" } )| stop-process -Force
- $arrCheck = [bool]($ProductGUID -is [array]) ;
- if( ($arrCheck -eq $False) -and ($ProductGUID -ne $null) ){ Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x $ProGUID /qn" }
- if( ($arrCheck -eq $True) -and ($ProductGUID -ne $null) ){ foreach ($ProGUID in $ProductGUID) { Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x $ProGUID /qn" }
- if( ($arrCheck -eq $False) -and ($ProductGUID -eq $null) ){ Write-Host("No Product with name available") -Fore Yellow }
- $ProductGUID = $null ; $ProGUID = $null }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement