if (exists snapshots of guest vms) then ((name of it of snapshot of guest vm as string) of devices of guest vms) else ("Unknown")
…you’re checking for (plural) existence of “snapshots of guest vms”, then trying to retrieve (singular) “name of snapshot of guest vm as string” The singluar “name of snapshot” will fail if more than one snapshot exists (and also if 0 exist). The “of it” in “name of it of snapshot” is unnecessary, and the “of devices of guest vms” is ignored because you don’t refer to it with “of it” anywhere inside the parenthesis. Try this to convert it back to a singular -
if (exists snapshots of guest vms) then (concatenation ";" of names of snapshots of guest vms) else ("no snapshots")
…this should list all the snapshots on the host.
Follow that up with
(name of it, if exists (snapshots of it) then (concatenation ";" of names of snapshots of it) else ("no snapshots")) of guest vms
…that should show each guest VM name, followed by a list of all snapshots for that guest.
(caution - I haven’t looked up the reference to see whether “guest vms” is a valid creation class, but I bet it is).