Powershell 查看网络适配器的高级属性,如Get-NetAdapterAdvancedProperty

Powershell 查看网络适配器的高级属性,如Get-NetAdapterAdvancedProperty,powershell,powershell-3.0,Powershell,Powershell 3.0,是否有一种方法可以查看网络适配器的高级属性,如Get-NetAdapterAdvancedProperty for Windows 2008 r2?我认为您必须使用WMIOObject类,类似于以下内容: Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Format-List * 要配置网络适配器,您可以找到一些信息和。我在Windows Server 2008中遇到了启用/禁用巨型数据包的相同问题。我为同样的目的写了这个脚本。

是否有一种方法可以查看网络适配器的高级属性,如Get-NetAdapterAdvancedProperty for Windows 2008 r2?

我认为您必须使用
WMIOObject类,类似于以下内容:

Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Format-List *

要配置网络适配器,您可以找到一些信息和。

我在Windows Server 2008中遇到了启用/禁用巨型数据包的相同问题。我为同样的目的写了这个脚本。它在我的测试虚拟机上运行良好

在生产中使用之前,请在任何测试机器上进行测试

$TargetKeys = Get-ChildItem -Path 'HKLM:\SYSTEM\ControlSet001\Control\Class\' -Recurse -ErrorAction SilentlyContinue

ForEach($TestKey In $TargetKeys)
{
    $KeyName = $TestKey.Name.Replace("HKEY_LOCAL_MACHINE","HKLM:")
    $SubKeys = Get-ChildItem -Path $KeyName -ErrorAction SilentlyContinue
    ForEach($SubKey In $SubKeys)
    {
        If($SubKey -ne $null -or $SubKey -ne '')
        {
            $ErrorActionPreference = 'SilentlyContinue'
            $ItemKey = $SubKey.Name.Replace("HKEY_LOCAL_MACHINE","HKLM:")
            $PropNames = ForEach($PropName In (Get-ItemProperty -Path $ItemKey -ErrorAction SilentlyContinue | GM -MemberType Properties -ErrorAction SilentlyContinue | Select Name)) { $PropName.Name }
            If($PropNames -contains '*JumboPacket')
            {
                # Set to 9014 for enabling and 1514 for disabling
                Set-ItemProperty -Path $ItemKey -Name '*JumboPacket' -Value 9014 -ErrorAction SilentlyContinue
                If($?)
                {
                    Write-Host "'Jumbo Packets' enabled successfully for Network card." -ForegroundColor Green
                }
                Else
                {
                    Write-Host "Error while enabling 'Jumbo Packets' for Network card." -ForegroundColor Red
                }
            }
            $ErrorActionPreference = 'Continue'
        }
    }
}

如果您正在寻找该功能,可以在server 2008上升级到powershell 4.0。升级到powershell 4.0似乎不会添加网络适配器cmdlet(在Windows 7上尝试)。的文档明确针对Windows Server 2012和Windows 8。