Complete uninstall Virtualbox
After you uninstall Virtualbox
from control Panel
You also have to delete the folder:
C:\Users\[Your User Name]\Appdata\Local\.virtualbox
You may have to enable Show hidden files and folders
option for Appdata
folder to be visible (see here for how to do this on Windows 7).
Disclaimer: this procedure is dangerous and can break your host system. Please backup your data or/and take a system image first. (That said, I've applied this procedure twice to my main Windows 7 machine, and the operating system is still running fine.)
My situation: I wanted to update from VirtualBox 5.1.22 to 5.1.28. The installer of newer version hanged near the end, so I needed to properly uninstall 5.1.22 first to get it work:
Download psexec.exe and CCleaner. Then unplug network cable, turn off wifi. Kill google drive, dropbox, and other system-invasive tools (and do this again if you restart during the procedure).
Uninstall using the VirtualBox uninstaller from Control Panel (for some reason I didn't have one on my machine).
Remove the folders
C:/Program Files/Oracle/VirtualBox
and%userprofile%\.VirtualBox
Remove virtual box drivers (files starting with VBox..) from
C:\Windows\system32\drivers\
Clean up windows registry: start
regedit.exe
as an administrator, search for VirtualBox everywhere and thoughtfully but carefully (don't break other stuff) delete the corresponding folders, keys and values.
At this point, I was blocked because I couldn't remove the children folders (which are VirtualBox network drivers) of Computer/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Enum/Root/NET/
folder. For me, the workaround consisted in
Download PsExec.exe to your desktop
Go Start and in "Start search" type in:
cmd
. Hold CTRL and SHIFT keys, press Enter. Command prompt window will open.Copy and paste following command:
"%userprofile%\desktop\psexec" -i -d -s c:\windows\regedit.exe
Using such the empowered version of regedit, you need
Take the ownership of
../NET
folder (right click, "Permissions...", Advanced, Owner tab, check on "Replace owner on subcontainers and objects")Add Full Control to OWNER RIGHTS
Remove all the children folders of
../NET
Maybe you'll need to play around with the permission further, machine restarts might help.
Goal: ../NET
should be clean of VirtualBox driver folders, and have the Full Control permissions for administrators and OWNER RIGHTS as well.
Then several passes of CCleaner followed by restarts, and finally you are clean. If everything was done correctly, you now will be able to successfully install the newest version of VirtualBox, if necessary.
Related question: How to uninstall Virtualbox on windows10?