Might be easier to do this in PowerShell ISE so you can edit these two commands. But this will first remove the installer package for OneDrive so that it can’t reinstall again, and then it removes the installed app from all profiles.
I haven’t personally tested this, but I use PowerShell professionally and the commands are solid. If it didn’t work then it just means that Microsoft packaged OneDrive in a different manner than the other built-in apps. You can also remove other annoying apps that are pre-loaded this way. Just swap out “OneDrive” for the proper name or partial proper name of the appx app. Use Get-AppxPackage by itself to learn what the proper names are for the apps that are installed.
Run a PowerShell session as admin and enter the following commands:
Get-AppxProvisionedPackage -Online | Where-Object { $_.PackageName -match “OneDrive” } | Remove-AppxProvisionedPackage -Online -AllUsers
Get-AppxPackage -AllUsers | Where-Object { $_.Name -match “OneDrive” } | Remove-AppxPackage -AllUsers
Might be easier to do this in PowerShell ISE so you can edit these two commands. But this will first remove the installer package for OneDrive so that it can’t reinstall again, and then it removes the installed app from all profiles.
I haven’t personally tested this, but I use PowerShell professionally and the commands are solid. If it didn’t work then it just means that Microsoft packaged OneDrive in a different manner than the other built-in apps. You can also remove other annoying apps that are pre-loaded this way. Just swap out “OneDrive” for the proper name or partial proper name of the appx app. Use Get-AppxPackage by itself to learn what the proper names are for the apps that are installed.