
- #Uninstall onedrive for business windows 10 powershell windows 10#
- #Uninstall onedrive for business windows 10 powershell windows#
I'm under this impression, because if I use the -and operator it will only remove the first Folder "C:\Users\$env:UserName\OneDrive"Īny suggestions to resolve this issue or improve the script overall would be appreciated. I think what is happening is that it is running the remove-Item -LiteralPath $dirpath portion before it is able to reach the logical operator. taskkill /f /im OneDrive.exe Next, execute the following command to uninstall OneDrive depending on your system architecture.
#Uninstall onedrive for business windows 10 powershell windows#
By Przemyslaw Klys Office 365 PowerShell Windows December 6, 2020. First, stop the OneDrive process with the below command. But every once in a while, I make some stupid mistake and delete a file that has yet. Right-click on it and select Run as administrator.
#Uninstall onedrive for business windows 10 powershell windows 10#
Reset OneDrive in Windows 10 If OneDrive synchronization gets stuck, performing a. Search for cmd or PowerShell in the start menu. When I run this script it does delete both folders that I'm intending to delete, but it returns "False" instead of "True" as I would expect. A command line client for Onedrive(including Office 365 and Business). It seems that there might be a logic issue with my conditional statement. #Remove-Item -LiteralPath "C:\Users\$env:UserName\OneDrive - CompanyName" -Force -Recurse Remove-PSDrive ' HKCR ' echo ' Removing startmenu shortcut ' rm -Force -ErrorAction Silentl圜ontinue ' env: userprofile \AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk ' echo ' Restarting explorer.exe ' start ' explorer. #Remove-Item -LiteralPath "C:\Users\$env:UserName\OneDrive" -Force -Recurse If ((test-path -LiteralPath $dirpath) -or (test-path -LiteralPath $dirpath2)) #conditional to delete OneDrive related folders of C Drive. $dirpath2 = "C:\Users\$env:UserName\OneDrive - CompanyName" $dirpath = "C:\Users\$env:UserName\OneDrive" #Added to Removes the OneDrive Folders that are on the laptop. If you don’t use OneDrive, however, and don’t want it running in the background, there are some hoops you can jump through to Completely Uninstall or Remove OneDrive in Windows 10. taskkill /f /im OneDrive.exe Next, execute the following command to uninstall. First, stop the OneDrive process with the below command. #To uninstall Onedrive if using a 32-bit system:Ĭ:\windows\System32\OneDriveSetup.exe /uninstall OneDrive comes installed with Windows 10 and is enabled by default if you sign on with a Microsoft account. OneDrive Uninstall Command (Command Prompt/PowerShell) Search for cmd or PowerShell in the start menu. #To uninstall OneDrive if using 64-bit System:Ĭ:\windows\SysWOW64\OneDriveSetup.exe /uninstall #Modified slightly for simplicity and to kill the OneDrive process before uninstallation of application So far I have the below: #Instructions found on ] However I'm having some troubles creating a solid script to uninstall OneDrive completely.

I've been able to create a small script to remove the items that are preinstalled from the Microsoft Store and one that uninstalls Teams completely.


I'm working on removing bloatware that is preinstalled on a number of computers.
