Filters:

  • Technologies

  • Instructors

  • How to open Windows Firewall ports using PowerShell

    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

    You may also like:  Using PowerShell to convert to the MiniShell on a Server 2012 R2 Datacenter Core Edition

    Share your thoughts...

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