Firewall Rule via Powershell

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Jannik Gisler Jannik Gisler 5 months ago.

  • Author
    Posts
  • #64341
    Profile photo of Jannik Gisler
    Jannik Gisler
    Participant

    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

  • #64353
    Profile photo of SkullyD
    SkullyD
    Participant

    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

    • #64366
      Profile photo of Jannik Gisler
      Jannik Gisler
      Participant

      Awsome, thank you!
      What a stupid mistake.

      kind regards,

      Jannik54

You must be logged in to reply to this topic.