You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring:
Using the latest DscNetworking from the PowershellGallery (plain Install-Module NetworkingDsc). The Firewall property will not handle square brackets in firewall rule names correctly. First run it will rightfully detect and create the rules. Second run the configuration Test fails and it tries to recreate the rule for an exception due to duplicate rules.
The DSC configuration that is using the resource (as detailed as possible):
The following configuration run locally towards the node localhost
Firewall FirewallRuleWithSquareBrackets
{
Name ="Square [Brackets]"
Ensure ="Present"
Group ="Debug"
LocalPort =65000
Protocol ="TCP"
}
Version of the Operating System and PowerShell the DSC Target Node is running:
Windows 10 Pro, 1803, Build: 17134.165
Name Value
---------
PSVersion 5.1.17134.165
PSEdition Desktop
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
BuildVersion 10.0.17134.165
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Debug output:
Output from Test-DscCounfiguration (after intitial run)
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ StartResource ] [[Firewall]FirewallRuleWithSquareBrackets]
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ StartTest ] [[Firewall]FirewallRuleWithSquareBrackets]
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Test-TargetResource: Checking settings for firewall rule with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Test-TargetResource: Find firewall rule with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Get-FirewallRule: No Firewall Rule found with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Test-TargetResource: Firewall rule with Name 'Square [Brackets]' does not exist.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Test-TargetResource: Check Firewall rule with Name 'Square [Brackets]' returning False.
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ EndTest ] [[Firewall]FirewallRuleWithSquareBrackets] False in0.1360 seconds.
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ EndResource ] [[Firewall]FirewallRuleWithSquareBrackets]
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ EndCompare ] Completed processing compare operation. The operation returned False.
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ EndCompare ] in14.2710 seconds.
Output from Start-DscConfiguration 2nd run:
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ StartResource ] [[Firewall]FirewallRuleWithSquareBrackets]
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ StartTest ] [[Firewall]FirewallRuleWithSquareBrackets]
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Test-TargetResource: Checking settings for firewall rule with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Test-TargetResource: Find firewall rule with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Get-FirewallRule: No Firewall Rule found with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Test-TargetResource: Firewall rule with Name 'Square [Brackets]' does not exist.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Test-TargetResource: Check Firewall rule with Name 'Square [Brackets]' returning False.
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ EndTest ] [[Firewall]FirewallRuleWithSquareBrackets] in0.1360 seconds.
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ StartSet ] [[Firewall]FirewallRuleWithSquareBrackets]
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Set-TargetResource: Applying settings for firewall rule with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Set-TargetResource: Find firewall rule with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Get-FirewallRule: No Firewall Rule found with Name 'Square [Brackets]'.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Set-TargetResource: We want the firewall rule with Name 'Square [Brackets]' to exist since Ensure is set to Present.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] Set-TargetResource: We want the firewall rule with Name 'Square [Brackets]' to exist, but it does not.
VERBOSE: [DESKTOP-S1LGPAL]: [[Firewall]FirewallRuleWithSquareBrackets] New-NetFirewallRule DisplayName: Square [Brackets]
Cannot create a file when that file already exists.
+ CategoryInfo : ResourceExists: (MSFT_NetFirewallRule:) [], CimException
+ FullyQualifiedErrorId : Windows System Error 183,New-NetFirewallRule+ PSComputerName : localhost
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ EndSet ] [[Firewall]FirewallRuleWithSquareBrackets] in0.2050 seconds.
The PowerShell DSC resource '[Firewall]FirewallRuleWithSquareBrackets' with SourceInfo 'C:\Git\automation-windows-htpc\HTPC.ps1::79::9::Firewall' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged
to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost
VERBOSE: [DESKTOP-S1LGPAL]: LCM: [ EndSet ]
The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1+ PSComputerName : localhost
The text was updated successfully, but these errors were encountered:
Good catch @vidarw and thanks for raising this. Looks like the -Name parameter needs to be escaped when calling Get-NetFirewallRule, Remove-NetFirewallRule and Set-NetFirewallRule because they support wildcards.
Details of the scenario you tried and the problem that is occurring:
Using the latest DscNetworking from the PowershellGallery (plain Install-Module NetworkingDsc). The Firewall property will not handle square brackets in firewall rule names correctly. First run it will rightfully detect and create the rules. Second run the configuration Test fails and it tries to recreate the rule for an exception due to duplicate rules.
The DSC configuration that is using the resource (as detailed as possible):
The following configuration run locally towards the node localhost
Version of the Operating System and PowerShell the DSC Target Node is running:
Windows 10 Pro, 1803, Build: 17134.165
Debug output:
Output from Test-DscCounfiguration (after intitial run)
Output from Start-DscConfiguration 2nd run:
The text was updated successfully, but these errors were encountered: