VMware Cloud Community
pamiller21
Enthusiast
Enthusiast
Jump to solution

Report Show NSX Tag

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

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos