1 Replies - 434 Views - Last Post: 15 August 2019 - 12:10 PM Rate Topic: -----

#1 TerraEnvy   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 45
  • Joined: 07-November 08

Powershell Checking specific firewall rule

Posted 15 August 2019 - 05:57 AM

Hello!
I am working on a pretty large powershell script and I have done this in batch before but can't figure it out for Powershell.

I need a command that can simply check if a firewall rule exists and put it into an if statement such as:

if (Firewall-checking-command Name=testname) {Write-Host "This program is already added" } else {Add firewall exception}

I have tried searching the internet and everything I find is for pulling results of a complete list of firewall entries and none for pulling a specific firewall rule by name.


Any assistance with this would be greatly appreciated.



-Terra

This post has been edited by TerraEnvy: 15 August 2019 - 05:59 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Powershell Checking specific firewall rule

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5457
  • View blog
  • Posts: 14,406
  • Joined: 18-April 07

Re: Powershell Checking specific firewall rule

Posted 15 August 2019 - 12:10 PM

Is this what you are looking for?

https://docs.microso...e?view=win10-ps

Shows there that one of the parameters is "Name"
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1