Microsoft OneDrive

Hi,

I’m trying to uninstall MS OneDrive by using this script but given exit code 128

waithidden taskkill /im OneDrive.exe /t /f
waithidden %systemroot%\SysWOW64\OneDriveSetup.exe /uninstall

Can assist to provide the correct action script and relevance?

Hey Haq,

One thing to keep in mind is that syntax like %systemroot% is a special function of the Windows command prompt. It parses your input, starting and ending with the % token and determines that should be pulled from a special/environment variable.

When you use waithidden in BigFix, under the hood it’s using a CreateProcess API call in Windows. This does not use the command prompt and so you cannot directly use environment variables in a waithidden statement.

With BigFix you never need to reference syswow64 because BigFix is a 32 bit process so this is accessible via the normal system32 path in BigFix as long as you’re not disabling redirection. See more here: https://developer.bigfix.com/action-script/reference/execution/action-uses-wow64-redirection.html

I’d try:

waithidden taskkill /im OneDrive.exe /t /f
waithidden C:\Windows\System32\OneDriveSetup.exe /uninstall

If you want to dynamically locate this folder you could do:

waithidden taskkill /im OneDrive.exe /t /f
waithidden {system x32 folder}\OneDriveSetup.exe /uninstall
5 Likes

Hi @strawgate,

Thanks for the reply, sorry for the late update but when i use the script given by you, it still showing an exit code (-2137219813). and later on my colleague tried this waithidden {(values “UninstallString” of it) of keys whose (value “DisplayName” of it as string contains “Microsoft OneDrive”) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of native registry}) and it works, now i have another scenario where endpoints have different versions of OneDrive. Should i remove the Displayversion from the script?

Hi!

The version your colleague gave you is the version I’d use too. You asked if you should remove displayversion but I don’t see it in any content here, can you provide your script again?

Generally for uninstall fixlets id only check version if there is a different uninstall process for older versions

Hi @strawgate,

this is the script that i use

waithidden {(values “UninstallString” of it) of keys whose (value “DisplayVersion” of it as string contains “23.054.0313.0001” and value “DisplayName” of it as string contains “Microsoft OneDrive”) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of native registry})

By including displayversion that will only work to remove that exact version of onedrive which is likely not what you want.

Hi @strawgate,

Yes, that’s correct, so i was thinking is there a way to have a script where it can triggers other version as well

You can, simply remove the displayversion part of the relevance.