This is not at all what I'm asking for. Tell me this:
Does $esxQ1 change for every host? Is that what you meant by
"The $esxQ1 variable is used to store the 1st qualifier of the FQDN of the ESXi hostname." ?
If so, this is exactly what I'm looking for and I didn't understand it. I think the Q1 part threw me off and that it referred only to ESX01.
This is why I asked what -PipelineVariable means. Does "Get-VMHost -PipelineVariable esx" create the $esx variable?
In short, if this loops through all of my hosts, pulls the vms on each, and creates a rule based on the name of the host, I'm good.
Finally, in the last line - -Type MustRunOn, is the other option ShouldRunOn?