Dear Witold Jabłoński,
Based on your requirements, here are the recommended PowerShell commands and approaches to enable the specified settings across different network profiles:
A) Private, Public, and Domain Networks: Network Discovery & File and Printer Sharing
You can enable these features using the following PowerShell commands:
powershell
# Enable Network Discovery
netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
# Enable File and Printer Sharing
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
These commands apply across all network profiles (Private, Public, Domain). If you need to target specific profiles, you can use the -Profile parameter with Set-NetFirewallRule.
B) All Networks: Public Folder Sharing
Public Folder Sharing settings are managed via registry keys. To enable sharing so that anyone with network access can read/write files in public folders:
powershell
Set-ItemProperty -Path "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" -Name "ForceGuest" -Value 0
Additionally, ensure the Public folder sharing service is running:
powershell
Set-Service -Name "LanmanServer" -StartupType Automatic
Start-Service -Name "LanmanServer"
C) Additional Considerations
The “Set up network-connected devices automatically” checkbox is part of device discovery and may require enabling SSDP and UPnP services.
Ensure the network profile is correctly set (Private, Public, Domain) using Get-NetConnectionProfile and Set-NetConnectionProfile.
These settings may be affected by Group Policy or security baselines in managed environments.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
Best regards,
Harry Phan