2015-03-02 63 views
0

我正在嘗試使用This Powershell script設置服務器2012R2網絡服務器的靜態源IP,但是當我運行Get-NetIPAddres命令時,我得到'術語Get-NetIPAddres'不被識別爲cmdlet的名稱」。如果我運行獲取命令得到-netip *它只返回以下命令:Server2012R2 - Get-NetIPAddress丟失?

Function  Get-NetIPHttpsConfiguration      NetworkTransition 
Function  Get-NetIPHttpsState        NetworkTransition 
Function  Get-NetIPsecDospSetting       NetSecurity 
Function  Get-NetIPsecMainModeCryptoSet      NetSecurity 
Function  Get-NetIPsecMainModeRule       NetSecurity 
Function  Get-NetIPsecMainModeSA        NetSecurity 
Function  Get-NetIPsecPhase1AuthSet       NetSecurity 
Function  Get-NetIPsecPhase2AuthSet       NetSecurity 
Function  Get-NetIPsecQuickModeCryptoSet      NetSecurity 
Function  Get-NetIPsecQuickModeSA       NetSecurity 
Function  Get-NetIPsecRule         NetSecurity 

從我讀過GET-NetIPAddress是操作系統的一部分,所以會有人有任何想法,爲什麼它將不可用?

我還有其他幾個2012 R2服務器返回Get-NetIPAddress的結果,我很難理解爲什麼這個服務器不會有這個命令。

+1

看起來NetTCPIP模塊未加載。 「Import-Module NetTCPIP」能做什麼嗎? – 2015-03-02 17:02:15

+0

這是問題所在。運行Import-Module NetTCPIP允許我運行該命令。謝謝! – 2015-03-03 09:13:00

回答

1

如果運行Get-Module你應該看到這樣的事情:

PS > Get-Module 

    ModuleType Version Name        ExportedCommands 
    ---------- ------- ----        ---------------- 
...... 
    Manifest 1.0.0.0 NetTCPIP       {Find-NetRoute, Get-NetCompartment, Get-NetIPAddress, Get-... 

此外,Get-Command Get-NetIPAddress提供有關您的cmdlet的詳細信息:

PS C:\Users\administrator.SMIS> Get-Command Get-NetIPAddress 

CommandType  Name            ModuleName 
-----------  ----            ---------- 
Function  Get-NetIPAddress         NetTCPIP 

運行此最後cmdlet之後的模塊應該已經是加載。如果沒有,您可以運行Import-Module NetTCPIP加載它,讓您可以訪問您的命令。