"add-newipaddress "的结果是 "Windows系统错误1168 "和 "找不到对象"

问题描述 投票:0回答:1

我安装了chocolatey,然后一切都出了问题。我不能在netadapter上添加任何新的IP地址。自从我 真的 想学习网络的故障排除,而不是重装我想解决我的问题。

PS C:\Windows\system32> New-NetIPAddress 192.168.3.2 -prefixlength 24 -InterfaceAlias "Hades Ethernet" -DefaultGateway 192.168.3.1
New-NetIPAddress : Element not found.
At line:1 char:1
+ New-NetIPAddress 192.168.3.2 -prefixlength 24 -InterfaceAlias "Hades  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_NetIPAddress:ROOT/StandardCimv2/MSFT_NetIPAddress) [New-NetIPAddress], CimException
    + FullyQualifiedErrorId : Windows System Error 1168,New-NetIPAddress

排除故障时。

PS C:\Windows\system32> get-netadapter | Get-NetIPAddress
Get-NetIPAddress : No matching MSFT_NetIPAddress objects found by CIM query for instances of the ROOT/StandardCimv2/MSFT_NetIPAddress class on the  CIM server: SELECT * FROM
MSFT_NetIPAddress  WHERE ((InterfaceIndex = 25)) AND ((InterfaceAlias LIKE 'Hades Ethernet')). Verify query parameters and retry.
At line:1 char:18
+ get-netadapter | Get-NetIPAddress
+                  ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_NetIPAddress:String) [Get-NetIPAddress], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetIPAddress


Get-NetIPAddress : No matching MSFT_NetIPAddress objects found by CIM query for instances of the ROOT/StandardCimv2/MSFT_NetIPAddress class on the  CIM server: SELECT * FROM
MSFT_NetIPAddress  WHERE ((InterfaceIndex = 28)) AND ((InterfaceAlias LIKE 'VirtualBox Host-Only Network')). Verify query parameters and retry.
At line:1 char:18
+ get-netadapter | Get-NetIPAddress
+                  ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_NetIPAddress:String) [Get-NetIPAddress], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetIPAddress

其他的适配器都能正常工作 我似乎在simv2上找不到任何关于这个问题的有用信息。

在get-netipinterface中也没有列出。

PS C:\Windows\system32> Get-NetIPInterface

ifIndex InterfaceAlias                  AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp     ConnectionState PolicyStore
------- --------------                  ------------- ------------ --------------- ----     --------------- -----------
5       Ethernet 3                      IPv6                  1500              35 Disabled Disconnected    ActiveStore
18      vEthernet (Switch LM)           IPv6                  1500              15 Enabled  Connected       ActiveStore
7       isatap.{B3B988D0-6CA7-42B5-9... IPv6                  1280              75 Disabled Disconnected    ActiveStore
26      isatap.{5F9C575A-3AA4-431C-A... IPv6                  1280              75 Disabled Disconnected    ActiveStore
11      vEthernet (VirtualBox Host-O... IPv6                  1500              25 Enabled  Connected       ActiveStore
16      vEthernet (Intel(R) 82574L G... IPv6                  1500              25 Enabled  Connected       ActiveStore
3       Reusable ISATAP Interface {2... IPv6                  1280              75 Disabled Disconnected    ActiveStore
24      isatap.fritz.box                IPv6                  1280              75 Disabled Disconnected    ActiveStore
8       Ethernet 1                      IPv6                  1500               5 Enabled  Disconnected    ActiveStore
6       isatap.{4002D68C-B8ED-4638-A... IPv6                  1280              75 Disabled Disconnected    ActiveStore
1       Loopback Pseudo-Interface 1     IPv6            4294967295              75 Disabled Connected       ActiveStore
5       Ethernet 3                      IPv4                  1500              35 Enabled  Connected       ActiveStore
18      vEthernet (Switch LM)           IPv4                  1500              15 Enabled  Connected       ActiveStore
11      vEthernet (VirtualBox Host-O... IPv4                  1500              25 Enabled  Connected       ActiveStore
16      vEthernet (Intel(R) 82574L G... IPv4                  1500              25 Enabled  Connected       ActiveStore
8       Ethernet 1                      IPv4                  1500               5 Disabled Connected       ActiveStore
1       Loopback Pseudo-Interface 1     IPv4            4294967295              75 Disabled Connected       ActiveStore


PS C:\Windows\system32> Get-NetIPInterface -ifIndex 25
Get-NetIPInterface : No MSFT_NetIPInterface objects found with property 'InterfaceIndex' equal to '25'.  Verify the value of the property and retry.
At line:1 char:1
+ Get-NetIPInterface -ifIndex 25
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (25:UInt32) [Get-NetIPInterface], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound_InterfaceIndex,Get-NetIPInterface

get-netadapter的输出中也没有列出,其中列出了Hades Ethernet和Virtual Box。

PS C:\Windows\system32> get-netadapter

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Ethernet 1                Intel(R) 82579LM Gigabit Network Con...       8 Disconnected 40-A8-F0-CA-D5-F5          0 bps
Management                Hyper-V Virtual Ethernet Adapter #3          18 Up           00-15-5D-6E-64-0B        10 Gbps
vEthernet (VirtualBox ... Hyper-V Virtual Ethernet Adapter #2          11 Up           0A-00-27-00-00-09         1 Gbps
vEthernet (Intel(R) 82... Hyper-V Virtual Ethernet Adapter             16 Up           40-A8-F0-CA-D5-F4         1 Gbps
Ethernet 3                TAP-Windows Adapter V9                        5 Disconnected 00-FF-32-EB-49-EE       100 Mbps
VirtualBox Host-Only N... VirtualBox Host-Only Ethernet Adapter        28 Up           0A-00-27-00-00-1C         1 Gbps
Hades Ethernet            Intel(R) 82574L Gigabit Network Conn...      25 Up           40-A8-F0-CA-D5-F4         1 Gbps

先谢谢你!

powershell networking windows-server-2016
1个回答
0
投票

好吧,根据例子 New-NetIPAddress, 请试试这个。

New-NetIPAddress -InterfaceIndex 25 -IPAddress 192.168.3.2 -PrefixLength 24 -DefaultGateway 192.168.3.1

为什么你目前所做的尝试可能是错误的?

在你的第一个例子中,我可以看到你使用了 InterfaceAlias 的 "哈迪斯以太网",而我可以看到这是适配器的名称。InterfaceAlias 是一个不同的字段,你可能会发现它的标签不同。你可以用下面的命令来确认。

Get-NetAdapter -InterfaceIndex 25 | Select-Object Name,InterfaceAlias,InterfaceIndex

在下面的命令中,你正在寻找一个与适配器相关联的IP地址,但由于你还没有设置,PowerShell无法找到它。

© www.soinside.com 2019 - 2024. All rights reserved.