What is the canonical way to use VMware's ovftool
to query to see if a VM exists or not?
If I run this command:
ovftool vi://username@password@myvsphere/mydatacenter/vm/myvm
I might get this response:
Error: Got fault from server: The attempted operation cannot be
performed in the current state (Powered on).
Error: Fault cause: vim.fault.InvalidState
I know I can do the following and then look for "Locator does not refer to an object" but is there a different command or (set of) option(s) I can run that will return a simple true
or false
or something else concise that does not indicate an error?
ovftool vi://username@password@myvsphere/mydatacenter/vm/avmthatisnothere
Just FYI the above returns this:
Error: Locator does not refer to an object:
vi://username@password@myvsphere/mydatacenter/vm/avmthatisnothere