Forum Discussion
Removing the incorrect office apps on devices
Hi all,
I have a strange thing with all our intune devices, we have 2 offices installed:
I need to remove the top one (Microsoft 365 - en-us) as it contains ONENOTE which we dont want on devices but within intune there is only one OFFICE we deploy which doesnt contain ONENOTE
When I remove Microsoft 365 - en-us manually onenote is removed
So does any one know how we remove the one that contains onenote?
Thanks in advance
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
- I guess you need to test it first ... but take a look at the uninstall reg key I am mentioning to get the proper displayname 🙂
$OfficeUninstallStrings = ((Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*") `
+ (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
}- AB21805Bronze ContributorHi Rudy,
thanks for this but no luck is there meant to be a space between " and DisplayLevel=False ?
- I will take a look what happens when I run it on a test device this afternoon, i will keep you posted!
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
- AB21805Bronze 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?