I don't know why I can't find this online, I am trying to match some VM names, but I only want to pull VMs that have 2 or more underscores "_" in their name, but the underscores are not going to be consecutive. I have been searching but I can't find what I want online, everything seems to have repeating characters.
Get-VM | where { $_.name -match "_" } # I just need that extra code for 2 underscores, that are not repeating
I would want to be able to find the first VM, but not the second.
VM_1_3
VM_1-3
---------------------------------------------------------------
Kunal Udapi
Sr. System Architect (Virtualization, Networking And Storage)
http://vcloud-lab.com
http://kunaludapi.blogspot.com
VMWare vExpert 2014, 2015, 2016
If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
---------------------------------------------------------------
Kunal Udapi
Sr. System Architect (Virtualization, Networking And Storage)
http://vcloud-lab.com
http://kunaludapi.blogspot.com
VMWare vExpert 2014, 2015, 2016
If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
It looks like my post was cut off. Thanks again, I was writing that I knew that it had to be something with the "_" being greater than 1, but I could not, and I see that I would not have figured this one out. Not even searching online would have produced these results since most sites just dealt with regex use that all were similar. Thanks again for this, it really helps.