1

I'm trying to enable folder sharing for all.

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes

Seems to work for File and Printer but

netsh advfirewall firewall set rule group="Public folder sharing" new enable=Yes

doesn't work (>>No rules match the specified criteria)

FoxyZ
  • 11
  • 3
  • I don't see a rule named "Public folder sharing". – joeqwerty Feb 28 '19 at 18:09
  • Exactly I'm not sure what's the name of the group for it too. But you can still find such a rule in Control Panel -> Advanced Sharing settings – FoxyZ Feb 28 '19 at 18:23
  • The command 'netsh advfirewall' only manages firewall settings, it has nothing to do with actually sharing folders. – Massimo Mar 01 '19 at 15:32
  • @FoxyZ did you ever find a definitive answer to your question? I need to do the same "enable" for public folder sharing (settings usually set in Network & Sharing > Advanced Sharing settings > Under All networks > Check "Turn on sharing..." I'm doing it for several Azure Cloud PCs for a third-party software and want to do it without touching each device (Using endpoint manager to deploy script if possible.) – hdaugherty Jan 11 '23 at 22:08

1 Answers1

1

Maybe I haven’t understood your question correctly, but with

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes

you configure firewall for SMB protocol(SMB is used for File/Folder sharing). So you should be able to create a share with:

net share sharename=folderpath /grant:username,permissions

If you require the Network Discovery:

netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
batistuta09
  • 8,981
  • 10
  • 23