Posts

Showing posts from 2015

how can you enable a windows firewall rule for a dynamic dns name or dns address

in a windows server sometimes you just need to enable some ports on your firewall to your dynamic dns address.(such as RDP , FTP , etc..) It is cumbersome when you do this manually every time your ip address changes.Why not update your server automatically every time when your ip changes based on your new dynamic dns update ? 1 ) just create a powershell script like this: $ip = [System.Net.Dns]::GetHostAddresses(" your ddnss address ").IpAddressToString Set-NetFirewallRule -DisplayName " myrule " -RemoteAddress $ip Put in your ddns name like: xxx.dydns.org , no-ip etc.. Create a firewall rule and define ports etc. before hand and name it either "myrule" and use the second line as it is ,or change the "myrule" to your rule's display name on advanced firewall app on windows server. 2) name it as firewall.ps1 3) and than create a task on task scheduler like this: command to execute: powershell -executionpolicy remotesigned -File