pamiller21
Enthusiast
Enthusiast

Find VMs with no NIC

Jump to solution

I am working on finding a method to find VMs without NICs (like vCLS) and apply a tag to them.  But not sure how to find that with a Get-VM.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

You can filter with a Where-clause, and then use the Tag-Assignment on the VMs that pass through.
The Tag I used is just an example, you could use any tag.

$noNIc = Get-Tag -Name NoNIC

Get-VM | where{(Get-NetworkAdapter -VM $_).Count -eq 0} |
New-TagAssignment -Tag $noNIC -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership

You can filter with a Where-clause, and then use the Tag-Assignment on the VMs that pass through.
The Tag I used is just an example, you could use any tag.

$noNIc = Get-Tag -Name NoNIC

Get-VM | where{(Get-NetworkAdapter -VM $_).Count -eq 0} |
New-TagAssignment -Tag $noNIC -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos