Skip to content

Instantly share code, notes, and snippets.

@mark05e
Last active January 15, 2025 02:37
Show Gist options
  • Save mark05e/b0066a3fdba54d3b59ac18152b8d1636 to your computer and use it in GitHub Desktop.
Save mark05e/b0066a3fdba54d3b59ac18152b8d1636 to your computer and use it in GitHub Desktop.
Uninstall the default office 365 installation that comes preinstalled. Maintenance Note - https://gist.github.com/mark05e/0a04a54c1e8489c770bd91e4910d7df9
#ref: https://www.reddit.com/r/sysadmin/comments/jjtpnp/script_to_silently_uninstall_builtin_office_365/
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration
$OfficeUninstallStrings = ((Get-ItemProperty "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*") `
+ (Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*") |
Where {$_.DisplayName -like "*Microsoft 365*"} |
Select UninstallString).UninstallString
ForEach ($UninstallString in $OfficeUninstallStrings) {
$UninstallEXE = ($UninstallString -split '"')[1]
$UninstallArg = ($UninstallString -split '"')[2] + " DisplayLevel=False"
Write-Host "Going to Run $UninstallEXE with $UninstallArg"
Start-Process -FilePath $UninstallEXE -ArgumentList $UninstallArg -Wait
}
Write-Host "Uninstall Completed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment