Prerequisites
Steps to reproduce
Running below configuration with PSDesiredStateConfiguration v2.0.7 in PowerShell produces a MOF file without the IPAddresses property. Using Windows PowerShell 5.1 instead a MOF file containing the IPAddresses property is created.
ConfigurationDnsServerForwarder_remove_config
{
Import-DscResource-ModuleName 'DnsServerDsc'
Node localhost
{
DnsServerForwarder 'SetForwarders'
{
IsSingleInstance ='Yes'
IPAddresses =@()
UseRootHint =$false
}
}
}Proposal
Lines 672-678 in PSDesiredStateConfiguration.psm1 should be changed from:
else
{
if ($targetTypeName-notmatch'Array'-or$p.Value.Count)
{
$p.Name+' = '+ (stringify -value $p.Value-asArray $asArray-targetType $targetType ) +";`n"
}
}to
else
{
$p.Name+' = '+ (stringify -value $p.Value-asArray $asArray-targetType $targetType ) +";`n"
}Expected behavior
instance of DSC_DnsServerForwarder as $DSC_DnsServerForwarder1ref{ResourceID = "[DnsServerForwarder]SetForwarders"; IPAddresses = {}; UseRootHint = False; SourceInfo = "::7::9::DnsServerForwarder"; IsSingleInstance = "Yes"; ModuleName = "DnsServerDsc"; ModuleVersion = "3.0.0"; ConfigurationName = "DnsServerForwarder_remove_config";};Actual behavior
instance of DSC_DnsServerForwarder as $DSC_DnsServerForwarder1ref{UseRootHint = False; SourceInfo = "::7::9::DnsServerForwarder"; IsSingleInstance = "Yes"; ResourceID = "[DnsServerForwarder]SetForwarders"; ModuleVersion = "3.0.0"; ModuleName = "DnsServerDsc"; ConfigurationName = "DnsServerForwarder_remove_config";};Error details
Environment data
Name Value
---------
PSVersion 7.4.7
PSEdition Core
GitCommitId 7.4.7
OS Microsoft Windows 10.0.20348
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Version
Visuals
No response
Prerequisites
Steps to reproduce
Running below configuration with PSDesiredStateConfiguration v2.0.7 in PowerShell produces a MOF file without the
IPAddressesproperty. Using Windows PowerShell 5.1 instead a MOF file containing theIPAddressesproperty is created.Proposal
Lines 672-678 in PSDesiredStateConfiguration.psm1 should be changed from:
to
Expected behavior
Actual behavior
Error details
Environment data
Version
Visuals
No response