Get all the Network Interfaces
$nics = Get-AzNetworkInterface | ?{ $_.VirtualMachine -NE $null}
I am stuck on ?{ $_.VirtualMachine -NE $null} can anyone help?
$nics = Get-AzNetworkInterface | ?{ $_.VirtualMachine -NE $null}
I am stuck on ?{ $_.VirtualMachine -NE $null} can anyone help?
2
Answers
?
is an alias forWhere-Object
Cmdlet. That meansis equivalent to
Here
Where-Object
selects objects from a collection based on their property values and$_
is a variable to refer the current item in the collection.NE is Comparision Operator which means Not Equals and $_ means it is using the present item. So, it means finding those Virtual Machines which are not equal to null in the collection.