diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c389b..96fbc84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ For older change log history see the [historic changelog](HISTORIC_CHANGELOG.md) - Fixed VMName property in example. - xVMNetworkAdapter - Fixed MacAddress sample data. + - Fixed Get-TargetResource failing for a ManagementOS adapter while trying + to obtain guest IP settings. - xVMSwitch - Correctly return the state as `$true` or `$false` depending on the `Ensure` property when the switch does not exist. diff --git a/source/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.psm1 b/source/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.psm1 index d1ed7ae..3bffa38 100644 --- a/source/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.psm1 +++ b/source/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.psm1 @@ -83,13 +83,13 @@ function Get-TargetResource { $configuration.Add('MacAddress', $netAdapter.MacAddress) $configuration.Add('DynamicMacAddress', $netAdapter.DynamicMacAddressEnabled) - } - $networkInfo = Get-NetworkInformation -VMName $VMName -Name $Name - if ($networkInfo) - { - $item = New-CimInstance -ClassName MSFT_xNetworkSettings -Property $networkInfo -Namespace root/microsoft/windows/desiredstateconfiguration -ClientOnly - $configuration.Add('NetworkSetting', $item) + $networkInfo = Get-NetworkInformation -VMName $VMName -Name $Name + if ($networkInfo) + { + $item = New-CimInstance -ClassName MSFT_xNetworkSettings -Property $networkInfo -Namespace root/microsoft/windows/desiredstateconfiguration -ClientOnly + $configuration.Add('NetworkSetting', $item) + } } $configuration.Add('Ensure', 'Present')