Forum Discussion
Removing the incorrect office apps on devices
- Oct 16, 2021
Hi, just changed some lines it ... nothing much but again.. you will need to change the displayname to exactly the app you whish to remove 🙂
$OfficeUninstallStrings = ((Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*") |
Where {$_.DisplayName -like "Microsoft 365 Apps for enterprise - en-us"} |
Select UninstallString).UninstallStringForEach ($UninstallString in $OfficeUninstallStrings) {
$UninstallEXE = ($UninstallString -split '"')[1]
$UninstallArg = ($UninstallString -split '"')[2] + " DisplayLevel=False"
Start-Process -FilePath $UninstallEXE -ArgumentList $UninstallArg -Wait
}Looks like its working at my end
Hi, just changed some lines it ... nothing much but again.. you will need to change the displayname to exactly the app you whish to remove 🙂
$OfficeUninstallStrings = ((Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*") |
Where {$_.DisplayName -like "Microsoft 365 Apps for enterprise - en-us"} |
Select UninstallString).UninstallString
ForEach ($UninstallString in $OfficeUninstallStrings) {
$UninstallEXE = ($UninstallString -split '"')[1]
$UninstallArg = ($UninstallString -split '"')[2] + " DisplayLevel=False"
Start-Process -FilePath $UninstallEXE -ArgumentList $UninstallArg -Wait
}
Looks like its working at my end
- AB21805Oct 18, 2021Bronze Contributor
I am unable to remove office
Here is the script (which I have tried to run manually on the device rather than intune first)
$OfficeUninstallStrings = ((Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*") |
Where {$_.DisplayName -like "Office 16 Click-to-Run Licensing Component"} |
Select UninstallString).UninstallStringForEach ($UninstallString in $OfficeUninstallStrings) {
$UninstallEXE = ($UninstallString -split '"')[1]
$UninstallArg = ($UninstallString -split '"')[2] + " DisplayLevel=False"
Start-Process -FilePath $UninstallEXE -ArgumentList $UninstallArg -Wait
}Any idea where I am going wrong?
- Oct 18, 2021I guess that one is not the one you need 🙂
- AB21805Apr 07, 2022Bronze Contributor
I have tried this again which worked when doing it locally:
$OfficeUninstallStrings = ((Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*") |
Where {$_.DisplayName -like "Microsoft 365 - en-us"} |
Select UninstallString).UninstallString
ForEach ($UninstallString in $OfficeUninstallStrings) {
$UninstallEXE = ($UninstallString -split '"')[1]
$UninstallArg = ($UninstallString -split '"')[2] + " DisplayLevel=False"
Start-Process -FilePath $UninstallEXE -ArgumentList $UninstallArg -Wait
}
But when trying through intune it succeeds but office isnt removed! Any ideas where i am going wrong?
Please help!