This section describes the VSS Command Line Interface in detail.
HelpTo 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.
CommonString 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 |
---|
language | pythonjson |
---|
linenumbers | false |
---|
|
{
"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. |
TableThe 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 |
---|
language | bash |
---|
linenumbers | false |
---|
|
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"
...
}
] |
YAMLAs with JSON, YAML can be easily decoded by many programming languages. The VSS CLI can provide the yaml
output as follows:
Code Block |
---|
language | bash |
---|
linenumbers | false |
---|
|
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-completionBash 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.
SourceHowever, there’s also a non-persistent method:
...
Code Block |
---|
language | bash |
---|
linenumbers | false |
---|
|
source <(vss-cli completion zsh) |
ShellThe VSS CLI provides a REPL interactive shell with tab-completion, suggestions and command history.
...