I make use of a Raspberry Pi running Kodi (OpenELEC) media centre which has access to various share folders from my main PC running Windows 10. Recently I’ve moved a lot of data from one hard drive (drive :D) to another (drive :I), after which I deleted the empty Movies share from Windows. Then, when I wanted to remove the empty share from OpenELEC I was unable to do so.
It seems that after moving the information in Movies to another drive and deleting the share folder thereafter, I created a dead share. Even though the Movies folder had been deleted from Windows, when I tried to share the information again using the same name (Movies) on another drive (drive :I), Windows renamed it to Movies2 and stated that there is already a share of the same name residing on drive :D.
Needless to say this was incredibly frustrating, thankfully though after several attempts at correcting the problem I was able to find a solution.
Open regedit and navigate to the below path, once in shares, locate the dead share folder and delete the entry.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares
After deleting the registry entry, the dead share no longer showed on OpenELEC and I was able to freely re-create the share on drive :I in Windows.