Pregunta

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?

¿Fue útil?

Solución

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 ]
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top