pamiller21
Enthusiast
Enthusiast

Report Show NSX Tag

Jump to solution

I am trying to make a report that shows all VMs with a specific NSX tag and then the creation dates for those VMs.  This is what I got so far without the creation date even and I can't seem to get this to pull correctly.

$report = Get-VM | where {(Get-NsxSecuritytagassignment -VirtualMachine $_) -eq 'TEST'} | select name

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

I was misled by your snippet.

That should probably be

Get-VM | where {(Get-NsxSecuritytagassignment -VirtualMachine $_).SecurityTag.name -eq 'TEST'} |

select Name,CreateDate


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership

For the VMs that are created in vSphere 6.7, and with a recent PowerCLI version, you can do

Get-VM | where {(Get-NsxSecuritytagassignment -VirtualMachine $_) -eq 'TEST'} |

select Name,CreateDate


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

0 Kudos
pamiller21
Enthusiast
Enthusiast

Somehow this doesn't print any VMs, but I just checked and I definatly do have a VM tagged with "TEST"

0 Kudos
LucD
Leadership
Leadership

I was misled by your snippet.

That should probably be

Get-VM | where {(Get-NsxSecuritytagassignment -VirtualMachine $_).SecurityTag.name -eq 'TEST'} |

select Name,CreateDate


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

View solution in original post

0 Kudos