Navigate the the location below in your registry and make the corresponding change.

Create two new DWORD values named 'NoFileSharing' and 'NoPrintSharing'. 

The data of these two values can be set to either 1 for sharing to be disabled, or 0 to enable sharing.  

Restart Windows.

Key:[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Network]
Data Type: REG_DWORD

 

Back to Network and Internet Tweaks