VMware Cloud Community
pamiller21
Enthusiast
Enthusiast
Jump to solution

Find VMs without NSX Security Tags

Is there a way to make a report that shows any vms without a security tag attached, print it to html, and add a total at the bottom.  Is this doable or is something needed to pull this data from NSX?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Great.

Can you try like this

Get-VM |

where {(Get-NsxSecuritytagassignment -VirtualMachine $_) -eq $null}

select name


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

View solution in original post

0 Kudos
25 Replies
LucD
Leadership
Leadership
Jump to solution

To start you could verify if those tags are visible with the regular tag cmdlets.

Do they show when you do a Get-TagAssignment?


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

It does not seem to show up with those commands.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Then you will have to use the PowerNSX module I guess.

Something like this

Get-VM | where{(Get-NsxSecuritytagassignment) -eq $null}


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

Sorry it just ask for a security tag:

pastedImage_0.png

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Then try the one I provided in Re: Security Tags in NSX


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

I am struggling hard on this, no idea why, but this is what I see when I just try to connect to my NSX Manager:

pastedImage_0.png

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I assume you already saw Kyle's post Getting Started with the PowerCLI Module for VMware NSX-T ?

The only difference I see is the credentials, but the error seems to come earlier.


Does adding the -Verbose switch give any more information?


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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Could this be a DNS issue?


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

No DNS name is used, just IP.  Wanted to rule that out to start.  I used the verbose tag and didn't show anything new.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you check the TLS version(s) your PowerShell session can use?

[Net.ServicePointManager]::SecurityProtocol

If TLS12 is not in there, run the following before trying the connection

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12,

    [System.Net.SecurityProtocolType]::Tls11,

    [System.Net.SecurityProtocolType]::Tls


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

Sorry shows this:

PS C:\Windows\system32> [Net.ServicePointManager]::SecurityProtocol

Tls12

PS C:\Windows\system32>

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That seems to be ok.

I'm at my wit's end, for now, I'm afraid.


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

Please forgive me, I am losing my mind slowly and simply typed the IP wrong.  Again VERY SORRY, but there is a new error:

pastedImage_0.png

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Are you getting the same error when you provide all the values on the cmdlet, instead of being prompted for them?


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

Yes both ways

0 Kudos
LucD
Leadership
Leadership
Jump to solution

To eliminate any 'dirty bits', did you stop/start your PowerShell session before trying again?


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

Ya I did that, no change

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I think you might want to open an SR for this.


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

0 Kudos
pamiller21
Enthusiast
Enthusiast
Jump to solution

Sorry where can I put a SR in for this product?

0 Kudos