2014-09-03 455 views
2

有沒有辦法查看網絡適配器的高級屬性,如Windows 2008 R2的Get-NetAdapterAdvancedProperty?查看網絡適配器的高級屬性,如Get-NetAdapterAdvancedProperty

+0

如果您正在尋找的功能,你可以升級到服務器上的PowerShell 4.0 2008年 – Matt 2014-09-03 11:24:46

+0

升級到PowerShell的4.0似乎沒有添加網絡適配器的cmdlet(試圖在Windows 7)。 [Get-NetAdapterAdvancedProperty](https://technet.microsoft.com/en-us/library/jj130901%28v=wps.630%29.aspx)的文檔明確針對Windows Server 2012和Windows 8。 – Kim 2015-12-02 09:28:06

回答

1

我認爲你必須去一個WmiObject Class,是這樣的:

Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Format-List * 

要配置網絡adapater,你可以找到一些信息herehere

0

我在使用/禁用JumboPackets時遇到了與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' 
     } 
    } 
}