How to open Windows Firewall ports using PowerShell

Home > Blogs > PowerShell > How to open Windows Firewall ports using PowerShell

How to open Windows Firewall ports using PowerShell

Like This Blog 0 Jason Helmick
Added by April 15, 2013

Recently I presenting at a conference and needed to demonstrate WMI. I specifically wanted to use the Get-WmiObject cmdlet instead of the new Get-CimInstance cmdlet because I wanted the demo to be useful for those still running PowerShell V2. All my remote computers are running Server 2012 and already have PowerShell Remoting enabled, so the PowerShell Remoting portion of the demonstration worked just fine, but when I tested my WMI demonstration the firewall on the remote computers blocked the WMI RPC calls. Since I needed to open the ports for WMI, why not use PowerShell Remoting and the new cmdlets for the firewall rules.

PS>Invoke-Command –ComputerName <remoteservers> {Enable-NetFirewallRule -name WMI-WinMgmt-In-TCP, WMI-RPCSS-In-TCP} 

Worked like a charm!

By the way, you should check out the firewall management cmdlets. Start with Get-Help *Firewall* and explore!

 

Knowledge is PowerShell,

Jason

Jason Helmick
Systems Instructor
Interface Technical Training

Videos You May Like

Windows 10 Managing, Deploying and Configuring – December 2, 2015

0 448 1

In this recorded Windows 10 training webinar from December 2, 2015, Windows Server instructor Rick Trader presents the deployment and management of Windows 10 Enterprise and the new Provisioning capability in Windows 10. Learn how to manage Windows 10 deployments using System Center Configuration Manager, Mobile Device Management and Intune. Also included in his presentation … Continue reading Windows 10 Managing, Deploying and Configuring – December 2, 2015

Windows 10 Features and Navigation – December 1, 2015

0 122 1

In this recorded Windows 10 webinar from December 1,2015, Windows Instructor Steve Fullmer presents the navigation and some of the new features associated with Windows 10 including Sysinternals Tools for Windows Client, Windows core concepts, exploring Process Explorer as well as some of the features that are not yet ready for prime time but will … Continue reading Windows 10 Features and Navigation – December 1, 2015

How to clone a Windows Server 2012 or 2012 R2 Domain Controller

3 1604 3

One of the coolest new features in Window Server 2012 and Windows Server 2012 R2 is the ability to clone a Domain Controller. In the past, if we had virtualized Domain Controllers and we actually took a snapshot of it and then rolled back to that snapshot, it would break the logon service on that … Continue reading How to clone a Windows Server 2012 or 2012 R2 Domain Controller

Write a Comment

Share your thoughts...

Please fill out the comment form below to post a reply.