-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't test a configuration that depends on Rename-NetAdapter #417
Comments
Hi @nmdange2, thank you for raising this. You do raise a good discussion point: should NetAdapterAdvancedProperty (and other similar networking resources) throw an exception in At the moment, that is the behavior we have adopted, but it might be worth reconsidering. Instead, should For Off the top of my head, I can't think of specific scenarios where removing the fatal error would cause a major issue. @johlju - any thoughts on this one? |
I would probably suggest Test-TargetResource should return $false if the adapter does not exist. |
Sorry for taking so long to answer. @nmdange2's comment made the notification jump to the top of the list. 😃 I don't think neither When running
|
Details of the scenario you tried and the problem that is occurring
I am attempting to run Test-DscConfiguration when I have to rename a network adapter and then assign a vlan. Even though I have DependsOn set, Test-DscConfiguration on the netadapteradvancedproperty is throwing a fatal error because the name does not exist. I am not sure if this is really an issue with this module or how Test-DscConfiguration works. I can successfully apply the configuration, but I can't test the configuration to see what changes will be made before applying them.
Verbose logs showing the problem
VERBOSE: : LCM: [ Start Resource ] [[NetAdapterName]RenameSMBNIC1]
VERBOSE: : LCM: [ Start Test ] [[NetAdapterName]RenameSMBNIC1]
VERBOSE: : [[NetAdapterName]RenameSMBNIC1] Test-TargetResource: Testing the
network adapter Name 'SMB_A'.
VERBOSE: : [[NetAdapterName]RenameSMBNIC1] Find-NetworkAdapter: Finding
network adapters matching the parameters.
VERBOSE: : [[NetAdapterName]RenameSMBNIC1] Test-TargetResource: Finding
network adapter matching search criteria.
VERBOSE: : [[NetAdapterName]RenameSMBNIC1] Find-NetworkAdapter: Finding
network adapters matching the parameters.
VERBOSE: : [[NetAdapterName]RenameSMBNIC1] Find-NetworkAdapter: 1 network
adapters were found matching the parameters.
VERBOSE: : [[NetAdapterName]RenameSMBNIC1] Test-TargetResource: network
adapter Name 'Ethernet 2' does not match the adapter 'SMB_A' that was found. Rename required.
VERBOSE: : LCM: [ End Test ] [[NetAdapterName]RenameSMBNIC1] False in 0.1410 seconds.
VERBOSE: : LCM: [ End Resource ] [[NetAdapterName]RenameSMBNIC1]
VERBOSE: : LCM: [ Start Resource ] [[NetAdapterAdvancedProperty]VlanSMBNic1]
VERBOSE: : LCM: [ Start Test ] [[NetAdapterAdvancedProperty]VlanSMBNic1]
VERBOSE: : [[NetAdapterAdvancedProperty]VlanSMBNic1] Test-TargetResource:
Checking if network adapter exists or not.
VERBOSE: : LCM: [ End Test ] [[NetAdapterAdvancedProperty]VlanSMBNic1] False in 0.1250 seconds.
VERBOSE: : LCM: [ FAILEDCompare ] Completed processing compare operation. The operation returned
False.
Suggested solution to the issue
Does not throwing a fatal error in Test-TargetResource when the adapter doesn't exist make sense to do?
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
PSVersion 5.1.17763.592
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.592
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used ('dev' if using current dev branch)
7.3.0.0
The text was updated successfully, but these errors were encountered: