문제

I am writing a script to do a silent install of a program on a windows machine using powershell. However I am hitting an issue where the program does not properly setup the machine's windows firewall settings. Is their a way for a powershell script that is being remotely executed to add a firewall port exception?

도움이 되었습니까?

해결책

You need to have remoting enabled on remote computer ( Enable-PSRemoting ). Enter in the remote session ( Enter-PSSession -ComputerName remotecomputername ) Then you can use the native commandline netsh to Enable/Disable Windows firewall using:

netsh firewall set opmode
                   [ mode = ] ENABLE|DISABLE
                   [ [ exceptions = ] ENABLE|DISABLE
                   [ profile = ] CURRENT|DOMAIN|STANDARD|ALL
                   [ interface = ] name ]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top