Reply to Message

View discussion in a popup

Replying to:
zik
Enthusiast
Enthusiast

switch also has a -regex flag:

$vms = Get-Cluster | Get-VM

Foreach($vm in $vms) {

    $vmview = $vm | get-view

    switch -Regex ($vmview.Summary.Config.GuestFullName) {

      "Windows" {"Windows"}

      "Linux" {"Linux"}

      "CentOS" {"CentOS"}

      default {"Other"}

    }

}

Tags I haven't worked with.

Reply
0 Kudos