• Welcome to Support Forum: Get Support for Patch My PC Products and Services.
 

Can't uninstall OneDrive

Started by joeOPD, March 13, 2022, 07:47:49 AM

Previous topic - Next topic

joeOPD

I'm trying to uninstall Onedrive for all of our machines.  We're using Intune and it's the version of OneDrive that comes with Windows 10.  In Intune, it always comes up with, "not installed".

Thoughts on how to remove this?

Adam Cook (Patch My PC)

Quote from: joeOPD on March 13, 2022, 07:47:49 AM
I'm trying to uninstall Onedrive for all of our machines.  We're using Intune and it's the version of OneDrive that comes with Windows 10.  In Intune, it always comes up with, "not installed".

Thoughts on how to remove this?

May you run the following on an exmaple device and share the .csv it produces? https://github.com/PatchMyPCTeam/CustomerTroubleshooting/blob/Release/PowerShell/Export-PMPCUninstallRegistryHives.ps1

May you also share all of the below with me from an example device, too, please?


  • %ProgramData%\PatchMyPCIntuneLogs\PatchMyPC-ScriptRunner.log
This may be found in the %ProgramData%\PatchMyPC\ if the Install was initiated by the user from Company Portal.
  • %ProgramData%\PatchMyPCIntuneLogs\PatchMyPC-SoftwareDetectionScript.log
  • %ProgramData%\PatchMyPCIntuneLogs\PatchMyPC-SoftwareUpdateDetectionScript.log
  • %ProgramData%\Microsoft\IntuneManagementExtension\Logs\AgentExecutor.log
  • %ProgramData%\Microsoft\IntuneManagementExtension\Logs\IntuneManagementExtension.log

All of this information will help me understand why the uninstall assignment evaluated as not required / not installed.

joeOPD

I looked at the PS script and saw it was looking at the uninstall strings.  I was unable to find the OneDrive uninstall strings in either of those trees.  That is excluding the version as well.  So perhaps the baked in version is not in the uninstall portion of the registry OR mine was removed during my experiments and was never readded to the uninstall tree.

[Context:LPT10ADM3173$)]~[Hive:HKLM:\SOFTWARE\WOW6432NODE\microsoft\windows\currentversion\uninstall\*]
03/02/2022 07:41:31~[Microsoft OneDrive*  22.012.0117.0003]~[Found:False]~[Purpose:Detection]~[Context:LPT10ADM3173$)]~[Hive:HKLM:\software\microsoft\windows\currentversion\uninstall\*]
03/02/2022 07:41:47~[Microsoft OneDrive*  22.012.0117.0003]~[Found:False]~[Purpose:Detection]~[Context:LPT10ADM3173$)]~[Hive:HKLM:\SOFTWARE\wow6432node\microsoft\windows\currentversion\uninstall\*]


At least on my machine, it's only found in the user-context (HKCU). 

INSTALL DIR:  C:\Users\MYUSERNAME\AppData\Local\Microsoft\OneDrive\22.033.0213.0002\
INSTALL DATE:  12/1/0001

KEY:  Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OneDriveSetup.exe
VALUE UNINSTALL STRING:  C:\Users\keulerj\AppData\Local\Microsoft\OneDrive\22.033.0213.0002\OneDriveSetup.exe  /uninstall

Adam Cook (Patch My PC)

Please share all the files, you can upload to patchmypc.com/share privately if you wish, or email them to [email protected].

joeOPD

I uploaded them!   Thanks for looking at them.

Adam Cook (Patch My PC)

Hey Joe

Thanks for sharing that.

The OneDrive installer in our catalogue is only supported for system-wide installations. The installation you have on your device is per-user. Therefore it makes sense the uninstall assignment evaluated as not applicable / required because it deemed OneDrive to not be installed (it was looking in HKLM, yours is in HKCU).

I just tested to see if we can support user-based OneDrive in our catalogue, and this does indeed look possible on initial testing. May you raise this as an idea here on our uservoice? https://ideas.patchmypc.com/ and share the link once created. I'll look to getting it added to the catalogue. I appreciate your use case here.

Adam Cook (Patch My PC)

If you wanted a solution right now, you could use this community script: https://github.com/PatchMyPCTeam/Community-Scripts/blob/main/Uninstall/Pre-Uninstall/Uninstall-Software/Uninstall-Software.ps1

I wrote it so let me know if you have any questions.

joeOPD

Quote from: Adam Cook on March 18, 2022, 11:26:18 AM
If you wanted a solution right now, you could use this community script: https://github.com/PatchMyPCTeam/Community-Scripts/blob/main/Uninstall/Pre-Uninstall/Uninstall-Software/Uninstall-Software.ps1

I wrote it so let me know if you have any questions.
One way to do it has been to Add the OneDrive install from PatchMyPC, let it deploy and then uninstall it.

With regards to your script.  Do we just add it as a script in Intune?  I'm wondering if it will work with Java 10.0.2?

Adam Cook (Patch My PC)

You could deploy it as a proactive remediation script in Intune, or package it in a custom Win32 package - both could work. I think the former might be easier.

It's general enough to work with any software that appears in the registry ARP keys and has an UninstallString registry value with data in it. It could do with some improvements, eg accept wildcard for -DisplayName parameter, and perhaps also look for QuietUninstallString registry value, too.

joeOPD

Quote from: Adam Cook on March 24, 2022, 08:44:14 AM
You could deploy it as a proactive remediation script in Intune, or package it in a custom Win32 package - both could work. I think the former might be easier.

It's general enough to work with any software that appears in the registry ARP keys and has an UninstallString registry value with data in it. It could do with some improvements, eg accept wildcard for -DisplayName parameter, and perhaps also look for QuietUninstallString registry value, too.
If I have the uninstall string could I create an ultra simple one-liner?

Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x {EECB2736-D013-5AC5-9917-7656712F6931} /quiet /noreboot" -Wait


Adam Cook (Patch My PC)

Yeah absolutely, if you know the UninstallString you can totally do that. Product codes _generally_ change between versions of software, so if that product code is consistent across all the devices you're targetting, you should be good - otherwise that's why the previously mentioned script is good. It helps you trigger the UninstallString if all you know is the product name, and have a mix of versions of said product.

joeOPD

Quote from: Adam Cook on March 25, 2022, 02:45:29 AM
Yeah absolutely, if you know the UninstallString you can totally do that. Product codes _generally_ change between versions of software, so if that product code is consistent across all the devices you're targetting, you should be good - otherwise that's why the previously mentioned script is good. It helps you trigger the UninstallString if all you know is the product name, and have a mix of versions of said product.
That's great!  Typically, I know the string because we are using vulnerability management software.  Oracle 10.0.2 is in our environment.  I added that one line to Intune but it's only successful part of the time.  Hoping I can get some consistency for software not in PMPC

Good news is that the OneDrive install through PMPC, wait a few days, then uninstall seems to have removed it.

joeOPD

Quote from: Adam Cook on March 25, 2022, 02:45:29 AM
Yeah absolutely, if you know the UninstallString you can totally do that. Product codes _generally_ change between versions of software, so if that product code is consistent across all the devices you're targetting, you should be good - otherwise that's why the previously mentioned script is good. It helps you trigger the UninstallString if all you know is the product name, and have a mix of versions of said product.

I know it's outside your scope (i.e. outside the product) but should you be bored...  https://serverfault.com/questions/1097162/intune-win32-app-uninstall-powershell-script-no-checking-registery

Basically, I created something similar to you which would allow my staff to put a product name in and deployed it as win32 app but the registry is not working.   Feel free to not invest any time because it's outside the scope of patchmypc.