Удаление и создание правил Windows Firewall-а через PowerShell

Создание правил:

New-NetFireWallRule -DisplayName "DPM_Agent_TCP" -Direction Inbound -Protocol TCP -LocalPort 135, 5718, 5719, 88, 289, 139, 445 -Enable True -Action Allow -Profile Domain

New-NetFireWallRule -DisplayName "DPM_Agent_UDP" -Direction Inbound -Protocol UDP -LocalPort 53, 88, 389, 137, 138 -Enable True -Action Allow -Profile Domain

New-NetFireWallRule -DisplayName "DPM_Agent_Coordinator" -Direction Inbound -Program "%windir%\Microsoft Data Protection Manager\DPM\ProtectionAgents\AC\5.0.158.0\dpmac.exe" -Enable True -Action Allow -Profile Domain


Удаление правил:

Remove-NetFireWallRule -DisplayName "DPM_Agent_TCP"

Remove-NetFireWallRule -DisplayName "DPM_Agent_UDP"

Remove-NetFireWallRule -DisplayName "DPM_Agent_Coordinator"



Также, можно добавить разрешение только на подключения с определенного ip-адреса:

New-NetFireWallRule -DisplayName "DPM_Agent_TCP" -Direction Inbound -Protocol TCP -LocalPort 135, 5718, 5719, 88, 289, 139, 445 -RemoteAddress 192.168.221.21 -Enable True -Action Allow -Profile Domain

New-NetFireWallRule -DisplayName "DPM_Agent_UDP" -Direction Inbound -Protocol UDP -LocalPort 53, 88, 389, 137, 138 -RemoteAddress 192.168.221.21 -Enable True -Action Allow -Profile Domain

New-NetFireWallRule -DisplayName "DPM_Agent_Coordinator" -Direction Inbound -Program "%windir%\Microsoft Data Protection Manager\DPM\ProtectionAgents\AC\5.0.158.0\dpmac.exe" -RemoteAddress 192.168.221.21 -Enable True -Action Allow -Profile Domain

Обновление от 23.07.2019:
У MS-а нашёл статью. В случае, если установка агента DPM не проходит, они рекомендуют вот что:

Netsh advfirewall firewall add rule name="DPM Replication Agent" dir=in program="C:\Program files\Microsoft Data Protection Manager\DPM\bin\dpmra.exe" profile=Any action=allow


Netsh advfirewall firewall add rule name="DPM DCOM setting" dir=in action=allow protocol=TCP localport=135 profile=Any

Netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=yes

Netsh advfirewall firewall add rule name="DPMAM_WCF_SERVICE" dir=in program="C:\Microsoft Data Protection Manager\DPM\bin\AMSvcHost.exe" profile=Any action=allow

Netsh advfirewall firewall add rule name="DPMAM_WCF_PORT" dir=in action=allow protocol=TCP localport=6075 profile=Any

P.S.
Если вся эта ересь сделана, но агент всё равно удалённо не ставиться, просто выключите их "дружелюбный" фаервол. После установки включите. Вот и всё.

Комментарии

Популярные сообщения из этого блога

Настройка TIME ZONE для Asterisk.

Макросы объединения ячеек в EXEL.