7 Replies Latest reply on Feb 20, 2014 5:06 PM by DZ1

    Regex match for a VM name.

    DZ1 Hot Shot



      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