Closed GeriOnline closed 7 years ago
Thank you! There are a few updates planned for this resource. I will make these changes as well during that. Also, these resources (cVMNetworkAdapter, cVMNetworkAdapterVlan, and cVMNetworkAdapterSettings) will be moved to xHyper-V module in PowerShell team's official repository later this week. They will be a part of the official DSC resource kit soon.
Great to hear that you will move your resources to the xHyper-V module. For that I have 2 wishes / suggestions:
Thanks for the suggestions. I have not tested the NatSwitch on TP5 yet. I will update it accordingly. For item 2, can you expand a bit and explain what is that you are looking for? What is Device Naming property? What does it relate to in the network adapter properties?
Device Naming: It's a new property for virtual network adapters of Hyper-V VMs since TP4 and Win10 Build 10586, also in TP5 and Win10 14322. Open Settings of a VM in Hyper-V, select and expand a Network Adapter of that VM and click Advanced Features. Scroll down the right Windows. At the end you will find the oprion "Device Naming" (see attached screen shot).
If checked it means later on in the guest VM you can identify that network adapter via it's Hyper-V name (and not only "Ethernet" ) through the advanced property "Microsoft Hyper-V Network Adapter" (see screen shot)
With Powershell you can find this with the following command:
Get-NetAdapterAdvancedProperty | where Displayname –eq “Hyper-V Network Adapter Name” | select Name, DisplayValue
So you can easily rename the ethernet adapters in the guest VM with the name defined in the Hyper-V settings.
Hope this helps.
Some more info for cNatSwitch: Here ist a small function to create a NAT switch the "new way":
Function New-NatSwitch ( $Name, $InternalIPInterfaceAddressPrefix, $PrefixLength, $GatewayIP ) { New-VMSwitch -Name $Name -SwitchType Internal
$ifindex = (Get-NetAdapter | where {$_.Name -match $Name}).ifIndex
New-NetIPAddress -IPAddress $GatewayIP -PrefixLength $PrefixLength -InterfaceIndex $ifindex
New-NetNat -Name $Name -InternalIPInterfaceAddressPrefix "$InternalIPInterfaceAddressPrefix/$PrefixLength"
}
Funnily enough this also works in TP4 and Win10 Build 586. And in addition it seems that there are no problems when removing all these objects in contrast to the implementation of the NATswitch.
A little help for Device Naming: For my lab I have already modified the cNetworkAdapterSettings. Find this Version in the attached ZIP. Note: I also had to extend the schema.mof file because of the new parameter "Device Naming". cVMNetworkAdapterSettings.zip
Thanks for the information and changes. I will make these changes and submit a PR upstream to xHyper-V. Of course, with due credits!
Hello Ravikanth, what's about new versions of the DSC resources we discussed above? You said these changes will be merged with the xHyper-V resource. But up to now I cannot find any newer versions. Thank you Gerhard
@GeriOnline I am pushing an updated module (cVMnetworkAdapter) to align it with the feedback from xHyper-V PR. I will eventually move this update to xHyper-V. Submitting modules to MSFT repo is hard and I am trying to catch up on the tech debt I created.
Great to see that you published a new version 3.0.0.0 of your cHyper-V DSC resource in the Powershell Gallery with fixes for my reported bug and implementation of my suggestion for 'Device Naming'. So I no longer need to manage my private fork. Thank you very much.
I think I can close now this issue. Good luck with submitting the modules to the MSFT repo. Gerhard
Hello,
I played a little bit with your DSC resource cNetWorkAdapter v. 2.6.1 and detected a script error in that module. In the function Test-TargetResource in line 221 you check with Get-VMNetworkAdapter if the specified netadapter exists and assign the result to variable $NetAdapterExists. However in the following script code you only reference a variable $AdapterExists, which is nowhere defined. So Test-TargetResource in some cases returns a wrong result.
I have changed the function code to always using the variable $NetAdapterExists and now it seems that Test-TargetResource returns always correct results (see the changed in my attached file).
It would be nice if you could take account of these changes in future versions.
Best regards Gerhard Glenk
cVMNetworkAdapter.psm1.zip