Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section describes the VSS Command Line Interface in detail.

Anchor
Help
Help
Anchor
Use-Help
Use-Help
Help

To get help when using the VSS CLI, you can add --help option to the end of a command. For example:

...

VSS CLI options vary from simple string, boolean or numeric values to JSON data structures as input parameters on the command line.

Anchor
Common
Common
Anchor
Use-Common
Use-Common
Common

String parameters can contain alphanumeric characters and spaces surrounded by quotes. The following example renames a virtual machine:

...

Some VSS CLI options and arguments require data to be formatted as JSON, such as reconfiguring a virtual machine guest operating system specification (hostname, domain, dns, ip, subnet and gateway) upon deployment. The option --custom-spec expects the following JSON data structure:

Code Block
languagepythonjson
linenumbersfalse
{
 "dhcp": false,
 "ip": "192.168.1.23",
 "gateway": ["192.168.1.1"],
 "dns": ["192.168.1.1"],
 "hostname": "vm1",
 "domain": "utoronto.ca"
}

...

Info

Environment variable VSS_OUTPUT always overrides any value set in the -o/--output option.

Anchor
Table
Table
Anchor
Use-Table
Use-Table
Table

The table format presents the VSS CLI output into tab-delimited lines, helpful when using grep, sed, and awk on Unix or Windows PowerShell.

...

Code Block
languagebash
linenumbersfalse
vss --output=json compute vm ls
[
    {
    "moref": "vm-1270",
    "name": "1910T-TestVM1",
    "provisioned_gb": 2.18,
    "tools_running_status": "guestToolsNotRunning",
    "tools_version": "0",
    "tools_version_status": "guestToolsNotInstalled",
    "uncommitted_bytes": 2338168320,
    "unshared_bytes": 996,
    "updated_on": "2020-04-21 Tue 02:10:03 EDT",
    "uuid": "5030f8d5-fa01-8eff-bb21-8d1ee7e6c230",
    "version": "vmx-15"
    ...
    }
]

Anchor
YAML
YAML
Anchor
Use-YAML
Use-YAML
YAML

As with JSON, YAML can be easily decoded by many programming languages. The VSS CLI can provide the yaml output as follows:

Code Block
languagebash
linenumbersfalse
 vss-cli --output=yaml compute vm ls -f name=%TEST% -s name desc

- moref: vm-2173
   name: 2004P-test-vm-centos
   provisioned_gb: 2.18
   tools_running_status: guestToolsNotRunning
   tools_version: '0'
   tools_version_status: guestToolsNotInstalled
   uncommitted_bytes: 2338168320
   unshared_bytes: 996
   updated_on: 2020-04-21 Tue 02:10:03 EDT
   uuid: 5030f8d5-fa01-8eff-bb21-8d1ee7e6c230
   version: vmx-15

Anchor
Auto-completion
Auto-completion
Anchor
Use-Auto-completion
Use-Auto-completion
Auto-completion

Bash completion support is provided by [Click][Click] and will complete sub commands and parameters. Sub commands are always listed whereas parameters only if at least a dash has been provided. Example:

...

After modifying the shell config, you need to start a new shell in order for the changes to be loaded.

Anchor
Source
Source
Anchor
Use-Source
Use-Source
Source

However, there’s also a non-persistent method:

...

Code Block
languagebash
linenumbersfalse
source <(vss-cli completion zsh)

Anchor
Shell
Shell
Anchor
Use-Shell
Use-Shell
Shell

The VSS CLI provides a REPL interactive shell with tab-completion, suggestions and command history.

...