Hi all
I’am testing DSC and have encountered a weird problem(weird for me atleast) when I try to set a clients DNS servers.
The setup
DSC Pull server (Windows 2012)
Client server ( Windows 2012 R2 )
xNetworking mdoule v2.1
$ConfigData = @{
AllNodes = @(
@{
NodeName = "ServerA"
)
}
Configuration NetworkTest
{
param
(
[Parameter(Mandatory)]
[string]$IPAddress,
[Parameter(Mandatory)]
[string]$InterfaceAlias,
[Parameter(Mandatory)]
[string]$DefaultGateway,
[Parameter(Mandatory)]
[int]$SubnetMask,
[Parameter(Mandatory)]
$DnsServerAddress,
[ValidateSet("IPv4","IPv6")]
[string]$AddressFamily = "IPv4"
)
Import-DscResource -Module xNetworking
node $AllNodes.NodeName
{
xIPAddress NewIPAddress
{
IPAddress = $IPAddress
InterfaceAlias = $InterfaceAlias
DefaultGateway = $DefaultGateway
SubnetMask = $SubnetMask
AddressFamily = $AddressFamily
}
xDnsServerAddress DnsServerAddress
{
Address = $DnsServerAddress
InterfaceAlias = $InterfaceAlias
AddressFamily = $AddressFamily
}
}
}
When I create the MOF with the following command:
NetworkTest -ConfigurationData $ConfigData -IPAddress "10.10.10.10" -DefaultGateway "10.10.10.1" -InterfaceAlias "Ethernet 2" -SubnetMask "24" -AddressFamily "Ipv4" -DnsServerAddress "10.10.10.2,10.10.10.3"
I get a MOF with the following DNS settings
instance of MSFT_xDNSServerAddress as $MSFT_xDNSServerAddress1ref
{
ResourceID = "[xDNSServerAddress]DnsServerAddress";
AddressFamily = "IPv4";
SourceInfo = "::29::6::xDnsServerAddress";
Address = {
"10.10.10.2,10.10.10.3"
};
ModuleName = "xNetworking";
InterfaceAlias = "Ethernet 2";
ModuleVersion = "2.1";
However I get the following error on the client
Server Address 10.10.10.2,10.10.10.3 is not in the correct format. Please correct the Address in the configuration and try again .
I have tried different formating but nothing seems to work.( … -DnsServerAddress “10.10.10.2”,“10.10.10.3” …-DnsServerAddress ‘10.10.10.2,10.10.10.3’ and so on…)
But if I change the MOF manually to(Adding dubble quotes … 11","10 …)
Address = {
"10.28.124.11","10.28.124.12"
};
Everything works fine(!), the client server configures its NIC So hopefully someone can spot my mistake and educate me.
Thanks in advance
/David