2023-07-28 11:30:00 -04:00
|
|
|
# Close all Office apps
|
|
|
|
|
End-Process -Name 'POWERPNT' -Match
|
|
|
|
|
End-Process -Name 'WINWORD' -Match
|
|
|
|
|
End-Process -Name 'EXCEL' -Match
|
|
|
|
|
End-Process -Name 'OUTLOOK' -Match
|
|
|
|
|
End-Process -Name 'MSPUB' -Match
|
|
|
|
|
End-Process -Name 'MSACCESS' -Match
|
|
|
|
|
End-Process -Name 'Teams' -Match
|
|
|
|
|
Start-Sleep -Seconds 5
|
|
|
|
|
|
|
|
|
|
End-Process -Name 'POWERPNT' -Match -Force
|
|
|
|
|
End-Process -Name 'WINWORD' -Match -Force
|
|
|
|
|
End-Process -Name 'EXCEL' -Match -Force
|
|
|
|
|
End-Process -Name 'OUTLOOK' -Match -Force
|
|
|
|
|
End-Process -Name 'MSPUB' -Match -Force
|
|
|
|
|
End-Process -Name 'MSACCESS' -Match -Force
|
|
|
|
|
End-Process -Name 'Teams' -Match -Force
|
|
|
|
|
|
2022-08-10 10:32:42 -04:00
|
|
|
# URL to the OffscrubC2R.vbs script
|
|
|
|
|
$UninstallScriptURL = 'https://github.com/OfficeDev/Office-IT-Pro-Deployment-Scripts/raw/master/Office-ProPlus-Deployment/Deploy-OfficeClickToRun/OffScrubc2r.vbs'
|
|
|
|
|
|
|
|
|
|
# The path to the local script once downloaded
|
|
|
|
|
$UninstallScript = Download-File -URL $UninstallScriptURL
|
|
|
|
|
|
|
|
|
|
# Args to pass to the OffscrubC2R.vbs script
|
|
|
|
|
$ScriptArgs = "/ALL /QUIET /NOCANCEL"
|
|
|
|
|
|
|
|
|
|
# Run the script
|
|
|
|
|
LogMsg "Uninstalling all Click2Run versions of Office"
|
|
|
|
|
Try { Start-Process "cscript.exe" -ArgumentList "//nologo ""${UninstallScript}"" ${ScriptArgs}" -Wait }
|
2023-07-28 11:30:00 -04:00
|
|
|
Catch { LogErr $_.Exception.Message }
|
|
|
|
|
|
|
|
|
|
# Delete the downloaded script
|
|
|
|
|
If ( Test-Path $UninstallScript ) {
|
|
|
|
|
LogMsg "Deleting downloaded script: ""${UninstallScript}"""
|
|
|
|
|
Remove-Item -Path $UninstallScript -Force -ErrorAction SilentlyContinue
|
|
|
|
|
}
|