For servers, to disable
HLKM\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters
AutoShareServer= "0" (STRING)
For servers, to enable
either remove the key totally, or
HLKM\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters
AutoShareServer= "1" (STRING)
For Workstations, use AutoShareWks instead