NetworkingDsc
NetworkingDsc copied to clipboard
xIPAddress: get-netipaddress erroraction stop
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
Hi @danSpotter - I see what you mean:
- In
Test-TargetResource
the cmdletGet-NetIPAddress
is called with EAsilentlycontinue
. - In
Set-TargetResource
the cmdletGet-NetIPAddress
is called with EAstop
.
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?
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
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.
Will try that first thing Monday morning!