Firewall Rule via Powershell

Hi everyone,

I want to set a Firewall rule on a computer in a Domain.
If I paste the Code in Powershell it works.
But when I safe the the code as a .ps1 file an run it as Admin I get this Error:

New-NetFirewallRule : Es wurde kein Positionsparameter gefunden, der das Argument “Mini” akzeptiert.
In C:\Users\gisj\Desktop\test.ps1:1 Zeichen:1

  • New-NetFirewallRule -Program “C:\Windows\dwrcs\DWRCS.EXE” -Action …
  •   + CategoryInfo          : InvalidArgument: (:) [New-NetFirewallRule], ParameterBindingException
      + FullyQualifiedErrorId : PositionalParameterNotFound,New-NetFirewallRule
    
    

My Code:

New-NetFirewallRule -Program “C:\Windows\dwrcs\DWRCS.EXE” -Action Allow -Profile Domain, Private, Public -DisplayName “DameWare Mini Remote Control Service” -Description “DameWare Mini Remote Control Service” -Direction Inbound

Why fails running the .ps1 file?

kind regards,

Jannik54

Looks like you are using wonky quotation marks.
New-NetFirewallRule -Program “C:\Windows\dwrcs\DWRCS.EXE” -Action Allow -Profile Domain, Private, Public -DisplayName “DameWare Mini Remote Control Service” -Description “DameWare Mini Remote Control Service” -Direction Inbound

Awsome, thank you!
What a stupid mistake.

kind regards,

Jannik54