10 Replies Latest reply on Mar 13, 2018 8:14 AM by LucD

    Get vms with 2 tags like

    CG21 Novice


      here is the script I would like,
      I would like to list the vms that are on windows in the DMZ cluster and have the following 2 tags:

      1_Tt_le_tps and criticite_moyenne

      but I have nothing on the file out

      can you help please ?



      Connect-viserver vcenter01 -user vcenter -pass password

      (Get-Cluster "DMZ" | Get-VM | where{$_.Guest.OSFullName -match "Windows"} |

      Get-TagAssignment | where{$_.Tag -like '1_Tt_le_tps*' -and $_.Tag -like 'criticite_moyenne*' }).Entity.Name |

      Out-File -FilePath C:\Scripts\Tags_patch\resultats\vms-tag-1_Tt_le_tps_DMZ_criticite_moyenne.txt