Skip to content

Enable-NetFirewallRule doesn't respect -WhatIf when called from advanced function #6556

@juliank

Description

@juliank

Steps to reproduce

function TestEnableNetFirewallRule() {
    [CmdLetBinding(SupportsShouldProcess=$true)]
    param ([string]$DisplayGroup)

    Enable-NetFirewallRule -DisplayGroup $DisplayGroup
 }

 TestEnableNetFirewallRule -DisplayGroup "Remote Desktop" -WhatIf

Expected behavior

The firewall rule is not enabled, and the same output as when calling Enable-NetFirewallRule -DisplayGroup "Remote Desktop" -WhatIf:

What if: Enable-NetFirewallRule DisplayName: RemoteDesktop-Shadow-In-TCP
What if: Enable-NetFirewallRule DisplayName: RemoteDesktop-UserMode-In-UDP
What if: Enable-NetFirewallRule DisplayName: RemoteDesktop-UserMode-In-TCP

Actual behavior

No output, and the firewall rule for Remote Desktop is enabled

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.251
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.251
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions