dsccommunity / dsccommunity/NetworkingDsc

Can't test a configuration that depends on Rename-NetAdapter

Open
#417 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
PowerShell
Stars
235
Forks
93
PR merge metrics
No merged PRs in 30d

Description

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)
NetAdapterName RenameSMBNIC1
{
	NewName = "SMB_A"
	MacAddress = $Node.SMB_NIC_1_MacAddr
	PhysicalMediaType = '802.3'
}

NetAdapterAdvancedProperty VlanSMBNic1
{
	NetworkAdapterName = "SMB_A"
	RegistryKeyword = "VlanID" 
	RegistryValue = 101
	DependsOn = "[NetAdapterName]RenameSMBNIC1"
}
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the NetAdapterName and NetAdapterAdvancedProperty resources and reproduce the configuration using Test-DscConfiguration on Windows Server 2019 with NetworkingDsc 7.3.0.0. Trace how DependsOn is handled during testing when the adapter is renamed, and verify completion by confirming that the dependent VLAN property can be tested without a fatal failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.