Unable to set firewall rule group="File and Printer Sharing" new enable=Yes in windows docker container

Issue type:- Unable to set firewall rules in windows docker container

  • OS Version/build :- Windows 10 as host machine and windows server core for docker container

  • App version:-
    buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
    compose: Docker Compose (Docker Inc., 2.0.0-beta.1)
    scan: Docker Scan (Docker Inc., v0.8.0)

  • Steps to reproduce
    We are trying to use psexec (pstools) on docker container for remote execuation of powershell commands.

We have used below command to enable SMB(Allowing File and Print Sharing in the Windows Firewall)

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

When we enter this command on docker container we got below error.

“An error occurred while attempting to contact the Windows Defender Firewall service. Make sure that the service is running and try your request again.”

Can someone help me to get this issue resolved.