need command line to test duplex status on windows NIC cards












2















this woud be for windows 7



I tried the following powershell command



get-wmiobject Win32_NetworkAdapter | foreach-object {   get-wmiobject -namespace root/WMI -class MSNdis_macOptions -filter "InstanceName='$($_.Name)'"}


but I can't seem to get usable info from this.










share|improve this question


















  • 1





    See this related question. It doesn't look like this is something that is available via the Windows API. It is typically something only available at the NIC driver level. Perhaps your NIC manufacturer might have something available. This post also confirms that.

    – heavyd
    May 9 '14 at 21:14


















2















this woud be for windows 7



I tried the following powershell command



get-wmiobject Win32_NetworkAdapter | foreach-object {   get-wmiobject -namespace root/WMI -class MSNdis_macOptions -filter "InstanceName='$($_.Name)'"}


but I can't seem to get usable info from this.










share|improve this question


















  • 1





    See this related question. It doesn't look like this is something that is available via the Windows API. It is typically something only available at the NIC driver level. Perhaps your NIC manufacturer might have something available. This post also confirms that.

    – heavyd
    May 9 '14 at 21:14
















2












2








2








this woud be for windows 7



I tried the following powershell command



get-wmiobject Win32_NetworkAdapter | foreach-object {   get-wmiobject -namespace root/WMI -class MSNdis_macOptions -filter "InstanceName='$($_.Name)'"}


but I can't seem to get usable info from this.










share|improve this question














this woud be for windows 7



I tried the following powershell command



get-wmiobject Win32_NetworkAdapter | foreach-object {   get-wmiobject -namespace root/WMI -class MSNdis_macOptions -filter "InstanceName='$($_.Name)'"}


but I can't seem to get usable info from this.







powershell wmi duplex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 9 '14 at 20:42









JackoJacko

11626




11626








  • 1





    See this related question. It doesn't look like this is something that is available via the Windows API. It is typically something only available at the NIC driver level. Perhaps your NIC manufacturer might have something available. This post also confirms that.

    – heavyd
    May 9 '14 at 21:14
















  • 1





    See this related question. It doesn't look like this is something that is available via the Windows API. It is typically something only available at the NIC driver level. Perhaps your NIC manufacturer might have something available. This post also confirms that.

    – heavyd
    May 9 '14 at 21:14










1




1





See this related question. It doesn't look like this is something that is available via the Windows API. It is typically something only available at the NIC driver level. Perhaps your NIC manufacturer might have something available. This post also confirms that.

– heavyd
May 9 '14 at 21:14







See this related question. It doesn't look like this is something that is available via the Windows API. It is typically something only available at the NIC driver level. Perhaps your NIC manufacturer might have something available. This post also confirms that.

– heavyd
May 9 '14 at 21:14












1 Answer
1






active

oldest

votes


















0














Since I don't have Windows 8 (and Get-NetAdapterAdvancedProperty) I used this to get the Speed/Duplex:



Update: This was driving me crazy. I was getting various errors with keys not existing, and it turns out certain devices will not have a speed/duplex like USB passthrough and Microsoft Cluster device. I updated it to use the enum value of duplex and also cycle through all available NICs.



Also, the original wasn't looking at the registry on the target, rather the localhost.



Function Get-NICSpeedDuplex {
Param (
[String]$computer
)
$key = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"

gwmi -Class Win32_NetworkAdapterConfiguration -Computer $computer -Filter "IPEnabled='$true'" | % {
$suffix = $([String]$_.Index).PadLeft(4,"0")

#get remote registry value of speed/duplex
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
$service = $reg.OpenSubKey("$key\$suffix\Ndi").GetValue("Service")
If ($service -imatch "usb") {
# This USB device will not have a '*SpeedDuplex' key
New-Object PSObject -Property @{
"Device" = $_.Description
"Speed/Duplex" = "USB Device"
}
} ElseIf ($service -imatch "netft") {
# Microsoft Clustered Network will not have a '*SpeedDuplex' key
New-Object PSObject -Property @{
"Device" = $_.Description
"Speed/Duplex" = "Cluster Device"
}
} Else {
$speedduplex = $reg.OpenSubKey("$key\$suffix").GetValue("*SpeedDuplex")
$enums = "$key$suffixNdiParams*SpeedDuplexenum"
New-Object PSObject -Property @{
"Device" = $_.Description
"Speed/Duplex" = $reg.OpenSubKey($enums).GetValue($speedduplex)
}
}
}
}


It's a little clunky hardcoding that registry key, but it seems to work on my Windows 7 PC and remote servers (2003/2008/2012). From this article : "The subkey represents the class of network adapter devices that the system supports."



Output of the script:



PS C:> Get-NICSpeedDuplex "test-server-xx" | ft -auto

Speed/Duplex Device
------------ ------
Auto Negotiation vmxnet3 Ethernet Adapter
Auto Negotiation vmxnet3 Ethernet Adapter #4
Cluster Device Microsoft Failover Cluster Virtual Adapter





share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f751783%2fneed-command-line-to-test-duplex-status-on-windows-nic-cards%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Since I don't have Windows 8 (and Get-NetAdapterAdvancedProperty) I used this to get the Speed/Duplex:



    Update: This was driving me crazy. I was getting various errors with keys not existing, and it turns out certain devices will not have a speed/duplex like USB passthrough and Microsoft Cluster device. I updated it to use the enum value of duplex and also cycle through all available NICs.



    Also, the original wasn't looking at the registry on the target, rather the localhost.



    Function Get-NICSpeedDuplex {
    Param (
    [String]$computer
    )
    $key = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"

    gwmi -Class Win32_NetworkAdapterConfiguration -Computer $computer -Filter "IPEnabled='$true'" | % {
    $suffix = $([String]$_.Index).PadLeft(4,"0")

    #get remote registry value of speed/duplex
    $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
    $service = $reg.OpenSubKey("$key\$suffix\Ndi").GetValue("Service")
    If ($service -imatch "usb") {
    # This USB device will not have a '*SpeedDuplex' key
    New-Object PSObject -Property @{
    "Device" = $_.Description
    "Speed/Duplex" = "USB Device"
    }
    } ElseIf ($service -imatch "netft") {
    # Microsoft Clustered Network will not have a '*SpeedDuplex' key
    New-Object PSObject -Property @{
    "Device" = $_.Description
    "Speed/Duplex" = "Cluster Device"
    }
    } Else {
    $speedduplex = $reg.OpenSubKey("$key\$suffix").GetValue("*SpeedDuplex")
    $enums = "$key$suffixNdiParams*SpeedDuplexenum"
    New-Object PSObject -Property @{
    "Device" = $_.Description
    "Speed/Duplex" = $reg.OpenSubKey($enums).GetValue($speedduplex)
    }
    }
    }
    }


    It's a little clunky hardcoding that registry key, but it seems to work on my Windows 7 PC and remote servers (2003/2008/2012). From this article : "The subkey represents the class of network adapter devices that the system supports."



    Output of the script:



    PS C:> Get-NICSpeedDuplex "test-server-xx" | ft -auto

    Speed/Duplex Device
    ------------ ------
    Auto Negotiation vmxnet3 Ethernet Adapter
    Auto Negotiation vmxnet3 Ethernet Adapter #4
    Cluster Device Microsoft Failover Cluster Virtual Adapter





    share|improve this answer






























      0














      Since I don't have Windows 8 (and Get-NetAdapterAdvancedProperty) I used this to get the Speed/Duplex:



      Update: This was driving me crazy. I was getting various errors with keys not existing, and it turns out certain devices will not have a speed/duplex like USB passthrough and Microsoft Cluster device. I updated it to use the enum value of duplex and also cycle through all available NICs.



      Also, the original wasn't looking at the registry on the target, rather the localhost.



      Function Get-NICSpeedDuplex {
      Param (
      [String]$computer
      )
      $key = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"

      gwmi -Class Win32_NetworkAdapterConfiguration -Computer $computer -Filter "IPEnabled='$true'" | % {
      $suffix = $([String]$_.Index).PadLeft(4,"0")

      #get remote registry value of speed/duplex
      $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
      $service = $reg.OpenSubKey("$key\$suffix\Ndi").GetValue("Service")
      If ($service -imatch "usb") {
      # This USB device will not have a '*SpeedDuplex' key
      New-Object PSObject -Property @{
      "Device" = $_.Description
      "Speed/Duplex" = "USB Device"
      }
      } ElseIf ($service -imatch "netft") {
      # Microsoft Clustered Network will not have a '*SpeedDuplex' key
      New-Object PSObject -Property @{
      "Device" = $_.Description
      "Speed/Duplex" = "Cluster Device"
      }
      } Else {
      $speedduplex = $reg.OpenSubKey("$key\$suffix").GetValue("*SpeedDuplex")
      $enums = "$key$suffixNdiParams*SpeedDuplexenum"
      New-Object PSObject -Property @{
      "Device" = $_.Description
      "Speed/Duplex" = $reg.OpenSubKey($enums).GetValue($speedduplex)
      }
      }
      }
      }


      It's a little clunky hardcoding that registry key, but it seems to work on my Windows 7 PC and remote servers (2003/2008/2012). From this article : "The subkey represents the class of network adapter devices that the system supports."



      Output of the script:



      PS C:> Get-NICSpeedDuplex "test-server-xx" | ft -auto

      Speed/Duplex Device
      ------------ ------
      Auto Negotiation vmxnet3 Ethernet Adapter
      Auto Negotiation vmxnet3 Ethernet Adapter #4
      Cluster Device Microsoft Failover Cluster Virtual Adapter





      share|improve this answer




























        0












        0








        0







        Since I don't have Windows 8 (and Get-NetAdapterAdvancedProperty) I used this to get the Speed/Duplex:



        Update: This was driving me crazy. I was getting various errors with keys not existing, and it turns out certain devices will not have a speed/duplex like USB passthrough and Microsoft Cluster device. I updated it to use the enum value of duplex and also cycle through all available NICs.



        Also, the original wasn't looking at the registry on the target, rather the localhost.



        Function Get-NICSpeedDuplex {
        Param (
        [String]$computer
        )
        $key = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"

        gwmi -Class Win32_NetworkAdapterConfiguration -Computer $computer -Filter "IPEnabled='$true'" | % {
        $suffix = $([String]$_.Index).PadLeft(4,"0")

        #get remote registry value of speed/duplex
        $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
        $service = $reg.OpenSubKey("$key\$suffix\Ndi").GetValue("Service")
        If ($service -imatch "usb") {
        # This USB device will not have a '*SpeedDuplex' key
        New-Object PSObject -Property @{
        "Device" = $_.Description
        "Speed/Duplex" = "USB Device"
        }
        } ElseIf ($service -imatch "netft") {
        # Microsoft Clustered Network will not have a '*SpeedDuplex' key
        New-Object PSObject -Property @{
        "Device" = $_.Description
        "Speed/Duplex" = "Cluster Device"
        }
        } Else {
        $speedduplex = $reg.OpenSubKey("$key\$suffix").GetValue("*SpeedDuplex")
        $enums = "$key$suffixNdiParams*SpeedDuplexenum"
        New-Object PSObject -Property @{
        "Device" = $_.Description
        "Speed/Duplex" = $reg.OpenSubKey($enums).GetValue($speedduplex)
        }
        }
        }
        }


        It's a little clunky hardcoding that registry key, but it seems to work on my Windows 7 PC and remote servers (2003/2008/2012). From this article : "The subkey represents the class of network adapter devices that the system supports."



        Output of the script:



        PS C:> Get-NICSpeedDuplex "test-server-xx" | ft -auto

        Speed/Duplex Device
        ------------ ------
        Auto Negotiation vmxnet3 Ethernet Adapter
        Auto Negotiation vmxnet3 Ethernet Adapter #4
        Cluster Device Microsoft Failover Cluster Virtual Adapter





        share|improve this answer















        Since I don't have Windows 8 (and Get-NetAdapterAdvancedProperty) I used this to get the Speed/Duplex:



        Update: This was driving me crazy. I was getting various errors with keys not existing, and it turns out certain devices will not have a speed/duplex like USB passthrough and Microsoft Cluster device. I updated it to use the enum value of duplex and also cycle through all available NICs.



        Also, the original wasn't looking at the registry on the target, rather the localhost.



        Function Get-NICSpeedDuplex {
        Param (
        [String]$computer
        )
        $key = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"

        gwmi -Class Win32_NetworkAdapterConfiguration -Computer $computer -Filter "IPEnabled='$true'" | % {
        $suffix = $([String]$_.Index).PadLeft(4,"0")

        #get remote registry value of speed/duplex
        $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
        $service = $reg.OpenSubKey("$key\$suffix\Ndi").GetValue("Service")
        If ($service -imatch "usb") {
        # This USB device will not have a '*SpeedDuplex' key
        New-Object PSObject -Property @{
        "Device" = $_.Description
        "Speed/Duplex" = "USB Device"
        }
        } ElseIf ($service -imatch "netft") {
        # Microsoft Clustered Network will not have a '*SpeedDuplex' key
        New-Object PSObject -Property @{
        "Device" = $_.Description
        "Speed/Duplex" = "Cluster Device"
        }
        } Else {
        $speedduplex = $reg.OpenSubKey("$key\$suffix").GetValue("*SpeedDuplex")
        $enums = "$key$suffixNdiParams*SpeedDuplexenum"
        New-Object PSObject -Property @{
        "Device" = $_.Description
        "Speed/Duplex" = $reg.OpenSubKey($enums).GetValue($speedduplex)
        }
        }
        }
        }


        It's a little clunky hardcoding that registry key, but it seems to work on my Windows 7 PC and remote servers (2003/2008/2012). From this article : "The subkey represents the class of network adapter devices that the system supports."



        Output of the script:



        PS C:> Get-NICSpeedDuplex "test-server-xx" | ft -auto

        Speed/Duplex Device
        ------------ ------
        Auto Negotiation vmxnet3 Ethernet Adapter
        Auto Negotiation vmxnet3 Ethernet Adapter #4
        Cluster Device Microsoft Failover Cluster Virtual Adapter






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 11 '14 at 22:48

























        answered Dec 11 '14 at 5:32









        xXhRQ8sD2L7ZxXhRQ8sD2L7Z

        23815




        23815






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f751783%2fneed-command-line-to-test-duplex-status-on-windows-nic-cards%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy