Skip to content

harsharora94/PoSH

Repository files navigation

PoSH

Useful Powershell scripts

How To Display Firewall Inbound/Outbound Rules With Port Numbers & Program Exceptions

Displaying firewall Inbound/Outbound rules with PowerShell is very easy with the Get-NetFirewallRule cmdlet. However, there is a gap: port numbers are not displayed.

With the use of calculated properties, Wirewall Firewall Inbound/Outbound Rules with Port Numbers & Program Exceptions can be displayed everything in a single output. Several cmdlets like the Select-Object or the Format-Table cmdlets can be used.

Summarize table with all the Important Powershell Cmdlets:

Get-NetIPInterface Shows you the available network interfaces. Can pass parameters to filter the results (e.g. only the DHCP assigned ones).
Get-NetIPAddress Shows you the IP addresses. Again, can filter using parameters.
Set-NetIPInterface Change an interface settings. Such as turn off/ on DHCP, IPv6 neighbor discovery settings, router settings (advertising, packet forwarding), and Wake on LAN.
New-NetIPAddress Assign a new IP address to an interface. Use the –DefaultGateway switch to specify the default gateway.
Remove-NetIPAddress Remove an assigned IP address from an interface.
Set-NetIPAddress Change IP address properties. For instance: change the subnet mask.
Rename-NetAdapter Rename a network adapter.
Disable-NetAdapter Disable a network adapter. To enable use Enable-NetAdapter.
Get-NetAdapterBinding View the network adapter bindings. Such as IPv4, IPv6, Client for Microsoft Networks.
Disable-NetAdapterBinding Disable network adapter bindings. To enable use Enable-NetAdapterBinding.
Get-NetRoute View the routing table.
New-NetRoute Add an entry to the routing table. Use destination prefix as 0.0.0.0/0 (for IPv4) or ::/0 (for IPv6) to set default gateway.
Remove-NetRoute Remove a routing table entry.
Get-DnsClient View the DNS client settings. Such as DNS suffix, search list and so on.
Get-DnsClientServerAddress View the DNS client server addresses.
Set-DnsClient Modify the DNS client settings.
Set-DnsClientServerAddress Add DNS client server addresses. Put multiple address as (“x.x.x.x”, “x.x.x.x.”, …"). Use the -ResetServerAddressesswitch to remove the server addresses

Releases

No releases published

Packages

No packages published