Author Posts

January 1, 2012 at 12:00 am

by nige-b at 2012-12-22 09:46:10

Hi,

I am using powershell v3 on Server 2012 and I want to change the speed & duplex setting from the default value of "Auto Negociation' to a 'hard coded' value such as 100 Mbps Full Duplex

Using Get-NetAdapterAdvancedProperty I see the following:

PS C:\Users\Administrator> Get-NetAdapterAdvancedProperty -Name 'Ethernet 2'

Name DisplayName DisplayValue RegistryKeyword Reg
—- ———– ———— ————— —
Ethernet 2 Flow Control Rx & Tx Enabled *FlowControl {3}
Ethernet 2 Interrupt Moderation Enabled *InterruptMo... {1}
Ethernet 2 IPv4 Checksum Offload Rx & Tx Enabled *IPChecksumO... {3}
Ethernet 2 Jumbo Frame Disabled *JumboPacket {15
Ethernet 2 Large Send Offload (IPv4) Enabled *LsoV1IPv4 {1}
Ethernet 2 Priority & VLAN Priority & VLAN Enabled *PriorityVLA... {3}
Ethernet 2 Receive Buffers 512 *ReceiveBuffers {51
Ethernet 2 Speed & Duplex Auto Negotiation *SpeedDuplex {0}

However if I pipe it to get-member which returns MSFT_NetAdapterAdvancedPropertySettingData objects I see no property listed for Speed & Duplex

If I filter on display name I get the following

PS C:\Users\Administrator> Get-NetAdapterAdvancedProperty -Name 'Ethernet 2' | Where-Object DisplayName -eq 'Speed & Dup
lex' | fl *

ValueName : *SpeedDuplex
ValueData : {0}
ifAlias : Ethernet 2
InterfaceAlias : Ethernet 2
ifDesc : Realtek PCI GBE Family Controller
Caption : MSFT_NetAdapterAdvancedPropertySettingData 'Realtek PCI GBE Family Controller'
Description : Speed & Duplex
ElementName : Speed & Duplex
InstanceID : {7842FCE8-2351-4918-9AEB-94CB53778CAB}::*SpeedDuplex
InterfaceDescription : Realtek PCI GBE Family Controller
Name : Ethernet 2
Source : 3
SystemName : WIN-GVAJK1M6P7F
DefaultDisplayValue : Auto Negotiation
DefaultRegistryValue : 0
DisplayName : Speed & Duplex
DisplayParameterType : 5
DisplayValue : Auto Negotiation
NumericParameterBaseValue :
NumericParameterMaxValue :
NumericParameterMinValue :
NumericParameterStepValue :
Optional : False
RegistryDataType : 1
RegistryKeyword : *SpeedDuplex
RegistryValue : {0}
ValidDisplayValues : {Auto Negotiation, 10 Mbps Half Duplex, 10 Mbps Full Duplex, 100 Mbps Half Duplex...}
ValidRegistryValues : {0, 1, 2, 3...}
PSComputerName :
CimClass : ROOT/StandardCimv2:MSFT_NetAdapterAdvancedPropertySettingData
CimInstanceProperties : {Caption, Description, ElementName, InstanceID...}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties

I have tried to change the setting using the following

(Set-NetAdapterAdvancedProperty -Name 'Ethernet 2').'Speed & Duplex' = '10 Mbps Half Duplex'

but get the following error

Set-NetAdapterAdvancedProperty : Either a display value or registry value must be specified
At line:1 char:2
+ (Set-NetAdapterAdvancedProperty -Name 'Ethernet 2').'Speed & Duplex' = '10 Mbps ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_NetAdapter...B53778CAB}:...):ROOT/StandardCi...ertySettingData) [
Set-NetAdapterAdvancedProperty], CimException
+ FullyQualifiedErrorId : Windows System Error 87,Set-NetAdapterAdvancedProperty

Not sure what I'm doing wrong. I am pretty new to powershell so any help would be most welcome.

by Klaas at 2012-12-23 01:43:11

If you try Get-NetAdapterAdvancedProperty | get-member you can see if there is a method to change the speed & duplex value.
Or with Get-Help Set-NetAdapterAdvancedProperty -Full | more you find what you can do with this cmdlet. In which module are those cmdlets?

by nige-b at 2012-12-23 05:12:00

Thanks.

There was no method to change the speed & duplex.

Having looked through the help again I have managed to get it working using:

Set-NetAdapterAdvancedProperty -DisplayName 'Speed & Duplex' -DisplayValue '100 Mbps Full Duplex'

This works fine but I'm still not sure why get-member does not list Speed & Duplex or if the above command is calling a method or changing a property value.