To allow file and printer sharing, you may need to open the Windows Firewall. Here’s a one line PowerShell script that allows file and printer sharing through the Windows Firewall by enabling the firewall rule group:
Enable-NetFirewallRule -Group "@FirewallAPI.dll,-28502" -Direction Inbound
To see a list of the available firewall groups, you can run the following:
Get-NetFirewallRule | Select-Object -Property Name, Group, Direction
Hope this helps!