-
Notifications
You must be signed in to change notification settings - Fork 90
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
NetAdapterName: InterfaceNumber doesn't seem to be working as it should #382
Comments
I think one solution might be: You are correct: I originally put the NetAdapterName RenameNetAdapter1AsPrivate {
NewName = 'Private'
DriverDescription = 'Hyper-V Virtual Ethernet Adapter'
InterfaceNumber = 1
}
NetAdapterName RenameNetAdapter2AsInternal {
NewName = 'Internal'
DriverDescription = 'Hyper-V Virtual Ethernet Adapter'
InterfaceNumber = 2
} But you're right - the above would fail without the Could you confirm you think the above behavior change would solve the issue? |
@PlagueHO Thats correct. Based off documentation and just what you would expect without reading documentation, you should only get 1 network adapter back based on what
It does work as it should. So maybe something like
|
Cool. Thanks @kungfu71186 - I'll leave it open for community comment, but assume that we'll make the proposed change. |
System.InvalidOperationException: A network adapter matching the parameters was not found. Please correct the properties and try again.
Details of the scenario you tried and the problem that is occurring
Doesn't seem to find the adapter based off the filter. Looking at the Find-Adapter function, I show:
VERBOSE: Find-NetworkAdapter: Finding network adapters matching the parameters.
VERBOSE: Find-NetworkAdapter: Found all network adapters because no filter parameters provided.
VERBOSE: Find-NetworkAdapter: 2 network adapters were found matching the parameters.
System.InvalidOperationException: Please adjust the parameters or specify IgnoreMultipleMatchingAdapters to only use the first and try again.
Looking at the code https://github.com/PowerShell/NetworkingDsc/blob/3db6d5ea444ee60ca4ffd8fd4e134763cd070e08/Modules/NetworkingDsc.Common/NetworkingDsc.Common.psm1#L235
And it appears you need the parameter IgnoreMultipleMatchingAdapters to be true and you need to specify the adapter number.
Find-NetworkAdapter -InterfaceNumber 1 -IgnoreMultipleMatchingAdapters $true -verbose
Suggested solution to the issue
Not sure what this variable would be used for to be honest, so can't provide a solution. I'm assuming it's for other filters that return more than 1 adapter and it shouldn't. In this case, I feel like if specify an interface number, it should just return that number from the array and not get the multiple matching error.
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 2016 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.2828.amd64fre.rs1_release_inmarket.190216-1457
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
Name Value
PSVersion 5.1.14393.2828
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2828
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)
NetAdapterName NetworkingDsc 7.0.0.0
The text was updated successfully, but these errors were encountered: