Sql-server – Removing a FILESTREAM windows share after uninstall

filestreamsql serversql-server-2017windows

I had to uninstall my local SQL 2017 Dev edition on my home PC (Windows 10) because I changed some drive structure (including where all the system databases lived) a while ago, so I needed to reinstall SQL Server to re-create those system databases (no backups since home Dev instance) and re-set the proper drive paths. I used a configuration file for the re-install process. It seems that when you uninstall SQL Server 2017 it does NOT remove the filestream share (bug?). So when I get to the install step on filestream, it says

Windows share MSSQLSERVER already exists and cannot be created for FILESTREAM file I/O. Specify another share name.

I've tried removing this existing MSSQLSERVER filestream windows share from admin command prompt by doing:

net share MSSQLSERVER /DELETE

But I get an error:

System error 3 has occurred.
The system cannot find the path specified.

So how can I delete this existing old MSSQLSERVER filestream windows share so I can proceed with the SQL 2017 setup and configure the new filestream share as part of the install process (using the same default MSSQLSERVER share name)?

Best Answer

I managed to find this answer on Stack Overflow.

https://serverfault.com/questions/543326/how-to-remove-a-windows-share-when-the-folder-does-not-exist-anymore/543350#543350

I removed the MSSQLSERVER share key from the registry at the below path, and rebooted. The share is no longer there in net share in command prompt.

I was able to proceed with my re-installation with FILESTREAM enabled.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares