I've been looking for a way to accomplish this for several weeks now; this is essentially the same question that was posted here on Stack Overflow almost two years ago, but the answer there doesn't work and I feel that this question is more applicable to super user (which itself has no questions on how to accomplish this specifically from command-line that I could find). None of the suggestions on MSDN or on technet were useful, and I could not find a command with
My deployment script has a block that looks like this:
echo Updating service settings... sc config fdPHost start= auto >nul sc start fdPHost >nul sc config FDResPub start= auto >nul sc start FDResPub >nul sc config SSDPSRV start= auto >nul sc start SSDPSRV >nul sc config upnphost start= auto >nul sc start upnphost >nul netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes >nul reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v everyoneincludesanonymous /t REG_DWORD /d 1 /f >nul reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters /v restrictnullsessaccess /t REG_DWORD /d 0 /f >nul net user guest ""
and elsewhere a block like this:
net share ExampleFolder="C:\ExampleFolder" /grant:Everyone,Read >nul net share Desktop="%USERPROFILE%\Desktop" /grant:Everyone,Read >nul icacls "C:\ExampleFolder" /grant Everyone:(OI)(CI)R /T /Q >nul icacls "%USERPROFILE%\Desktop" /grant Everyone:(OI)(CI)R /T /Q >nul
The end goal is for all of the devices on this network to be able to see each other, and for a user with no password to be able to copy to/modify files on all of the other computers' Desktops and ExampleFolders. The only thing I need to happen that these blocks don't accomplish is the toggling of the Password Protected Sharing option located here:
Control Panel\All Control Panel Items\Network and Sharing Center\Advanced sharing settings
While it's too late to implement any potential good/working answer into my deployment package, I'm curious enough now to open a Question and potentially give it a bounty (when the option is available). As the tags imply - I'm looking for a pure command-line (cmd.exe) method of accomplishing this on Windows 10, which at some point will probably be added to a batch file. This deployment is on a mid-sized, air-gapped LAN - so please don't feel too bad about what the above settings mean from a security standpoint.