NetworkingDsc icon indicating copy to clipboard operation
NetworkingDsc copied to clipboard

xIPAddress: get-netipaddress erroraction stop

Open danSpotter opened this issue 7 years ago • 4 comments

xipaddress will not assign a new ipv6 ip where dhcp is enabled. Error action is set to stop. If set to silentlycontinue the test-targetresource takes 30 seconds to complete.

$GetNetIPAddressSplat = @{ InterfaceAlias = $InterfaceAlias AddressFamily = $AddressFamily ErrorAction = 'Stop' } $currentIPs = @(Get-NetIPAddress @GetNetIPAddressSplat)

PowerShell DSC resource MSFT_xIPAddress failed to execute Set-TargetResource functionality with error message: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: No matching MSFT_NetIPAddress objects found by CIM query for instances of the ROOT/StandardCimv2/MSFT_NetIPAddress class on the CIM server: SELECT * FROM MSFT_NetIPAddress WHERE ((InterfaceAlias LIKE 'Ethernet 2')) AND ((AddressFamily = 23)). Verify query parameters and retry. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : localhost

Windows 2012 R2 xnetworking 5.2.0.0

danSpotter avatar Nov 13 '17 20:11 danSpotter

Hi @danSpotter - I see what you mean:

  • In Test-TargetResource the cmdlet Get-NetIPAddress is called with EA silentlycontinue.
  • In Set-TargetResource the cmdlet Get-NetIPAddress is called with EA stop.

I'm trying to think if there might be any consequence to using EA of silentlycontinue to the cmdlet Get-NetIPAddress in Set-TargetResource. The 30 second delay does sound a bit concerning as well. Does this 30 second delay only occur when first converting the IPv6 address from DHCP to static or does it occur every time?

PlagueHO avatar Dec 03 '17 20:12 PlagueHO

I have a similar problem. I have a static IP address of 10.110.194.33/24. When I try to add a list of addresses, I get the message that the first address already exists and the error behavior is to stop. When I change the behavior in the Set-TargetResource to Continue it works.

PS C:> invoke-dscresource -ModuleName xnetworking -name xipaddress -method set -Property @{ addressfamily = "IPV4"; InterfaceAlias = "Ethernet0"; IPAddress = "10. 110.194.33/24", "10.110.194.132/24", "10.110.194.133/24", "10.110.194.134/24", "10.110.194.135/24", "10.110.194.136/24", "10.110.194.137/24"; } AVERTISSEMENT : L'état du Gestionnaire de configuration local est modifié par des opérations non DSC. Si vous souhaitez modifier l'état du Gestionnaire de configuration local, utilisez l'applet de commande Remove-DscConfigurationDocument. La ressource DSC PowerShell MSFT_xIPAddress n'a pas pu exécuter la fonctionnalité Set-TargetResource. Message d'erreur: L’exécution de la commande s’est arrêtée, car la variable de préférence «ErrorActionPreference» ou le paramètre courant a la valeur Stop: Instance MSFT_NetIPAddress already exists

+ CategoryInfo          : InvalidOperation : (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName        : localhost

yvesgermain avatar Jul 06 '18 21:07 yvesgermain

Hi @yvesgermain - have you tried the new IPAddress in NetworkingDsc 6.0.0 (xNetworking has been renamed to NetworkingDsc)? This fix (https://github.com/PowerShell/NetworkingDsc/pull/331) may have resolved your issue - but it went out in 6.0.0.

PlagueHO avatar Jul 06 '18 22:07 PlagueHO

Will try that first thing Monday morning!

yvesgermain avatar Jul 07 '18 06:07 yvesgermain