3

If I run Get-NetIPInterface -ifIndex 29 -IncludeAllCompartments, I get one Interface back.

There are only 2 Compartments I checked this via @(Get-NetCompartment).Count. The Compartment IDs are 1 and 2. This information is also printed by Get-NetCompartment.

But If I run Get-NetIPInterface -CompartmetId 2 I get this error:

PS C:\Users\Administrator> Get-NetIPInterface -ifIndex 29 -CompartmentId 1
Get-NetIPInterface : No matching MSFT_NetIPInterface objects found by CIM query for instances of the
ROOT/StandardCimv2/MSFT_NetIPInterface class on the  CIM server: SELECT * FROM MSFT_NetIPInterface  WHERE
((InterfaceIndex = 29)) AND ((CompartmentId = 1)). Verify query parameters and retry.
At line:1 char:1
+ Get-NetIPInterface -ifIndex 29 -CompartmentId 1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_NetIPInterface:String) [Get-NetIPInterface], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetIPInterface

or this

PS C:\Users\Administrator> Get-NetIPInterface -ifIndex 29 -CompartmentId 2
Get-NetIPInterface : No matching MSFT_NetIPInterface objects found by CIM query for instances of the
ROOT/StandardCimv2/MSFT_NetIPInterface class on the  CIM server: SELECT * FROM MSFT_NetIPInterface  WHERE
((InterfaceIndex = 29)) AND ((CompartmentId = 2)). Verify query parameters and retry.
At line:1 char:1
+ Get-NetIPInterface -ifIndex 29 -CompartmentId 2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_NetIPInterface:String) [Get-NetIPInterface], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetIPInterface

PS C:\Users\Administrator>

Why do I get this error?
If the Interface is not in Compartment 1 and not in Compartment 2, where it is?

More Information:

PS C:\Users\Administrator>  Get-NetIPInterface -ifIndex 29 -IncludeAllCompartments

ifIndex InterfaceAlias                  AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp     ConnectionState PolicyStore
------- --------------                  ------------- ------------ --------------- ----     --------------- -----------
29      NIC_INTERN_CONTOSO              IPv4                  1500               5 Disabled Connected       ActiveStore

PS C:\Users\Administrator> Get-NetCompartment


CompartmentId          : 1
CompartmentDescription : Default Compartment
CompartmentGuid        : !SOME NUMBERS!

CompartmentId          : 2
CompartmentDescription : COMPARTMENT2
CompartmentGuid        : !SOME NUMBERS"

1 Answer 1

1

You should be able to use something like this to find out what CompartmentId it is in:

Get-NetIPInterface -ifIndex 29 -IncludeAllCompartments | ForEach-Object { "$($_.InterfaceAlias) - $($_.CompartmentId)" }

Use that to check that it actually is in one of those compartments.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .