Workstation Pro の vmcli コマンドライン ユーティリティを使用して、Linux ターミナル ウィンドウまたは Windows コマンド プロンプトからハイパーバイザーを操作できます。vmcli コマンドを使用すると、新しい仮想マシンや仮想マシン テンプレートの作成など、さまざまな仮想マシン操作を実行できます。
vmcli コマンドライン ユーティリティの実行
vmcli は、Linux ターミナル ウィンドウまたは Windows コマンド プロンプトから実行できます。また、複数のコマンドを実行するスクリプトを作成することもできます。
vmcli コマンドを実行し、提供される機能を使用するための構文を取得するには、次のコマンドを実行します。
vmcli --help
このコマンドを実行すると、次の出力が表示されます。
vmcli --help
Usage: vmcli [-v | --version] [<vmx location>] <module> <command> [<args>] [--verbose] [-h | --help] [<vmx location>]
Top level arguments:
-v, --version
Display the version information.
Global arguments:
<vmx location> (required for commands working with VMs)
Location of the vmx file to work with. Can be the first or last argument on the command line.
--verbose
Enable verbose logging.
-h, --help
Display the help information
Available modules:
Chipset
Chipset options.
ConfigParams
Set VM configuration parameters.
Disk
Module to perform disk operations.
Ethernet
Setup the ethernet configuration in the guest.
Guest
guest ops
HGFS
HGFS options.
MKS
Mouse, keyboard and screen operations.
Nvme
Setup NVME ports in the guest.
Power
Set the power state of the vm.
Sata
Setup SATA ports in the guest.
Serial
Setup serial ports in the guest.
Snapshot
Snapshot configuration
Tools
Tools related configuration.
VM
VM related Operations
VMTemplate
Create and Deploy vm template
VProbes
Setup VProbes in the guest
Power モジュールなど、各モジュールまたは操作の構文の詳細については、次のコマンドを実行します。
vmcli Power --help
このコマンドを実行すると、次の出力が表示されます。
vmcli Power --help
Usage: vmcli [-v | --version] [<vmx location>] Power [--verbose] [-h | --help] query Start Stop Pause Reset Suspend Unpause [<vmx location>]
Top level arguments:
-v, --version
Display the version information.
Global arguments:
<vmx location> (required for commands working with VMs)
Location of the vmx file to work with. Can be the first or last argument on the command line.
--verbose
Enable verbose logging.
-h, --help
Display the help information
Module:
Power
Set the power state of the vm.
Arguments available to module "Power":
query
Query the power state of the VM.
Start
Start the virtual machine.
Stop
Stop the virtual machine.
Pause
Pause the virtual machine.
Reset
Rest the virtual machine.
Suspend
Suspend the virtual machine.
Unpause
Unpause the virtual machine.
また、任意のモジュールの特定の操作の使用情報を取得することもできます。
vmcli Power query --help
このコマンドを実行すると、次の出力が表示されます。
vmcli power query --help
Usage: vmcli [-v | --version] [<vmx location>] Power query [--verbose] [-h | --help] [-f | --format <2, 1, 0>] [<vmx location>]
Top level arguments:
-v, --version
Display the version information.
Global arguments:
<vmx location> (required for commands working with VMs)
Location of the vmx file to work with. Can be the first or last argument on the command line.
--verbose
Enable verbose logging.
-h, --help
Display the help information
Module:
query
Query the power state of the VM.
Arguments available to module "query":
-f, --format <2, 1, 0>
Sets the format of the output.
vmcli を使用して既存の仮想マシンからテンプレートを作成する
仮想マシン テンプレートは既存の仮想マシンから作成できます。後でこのテンプレートを使用して、同じ構成の新しい仮想マシンを作成できます。
次の構文を使用できます。
vmwcli <source vmx path> vmtemplate create -p <template vmtx path> -n <template name>
| 変数 | 説明 |
|---|---|
| source vmx path | テンプレートの作成元となるソース仮想マシン vmx へのパス。 |
| template vmtx path | 新しい vmtemplate フォルダへのフル パスと、.vmtx 拡張子を持つファイル名。 例: |
| template name | テンプレートの名前。 |
vmcli を使用して仮想マシン テンプレートをデプロイする
vmcli コマンドによって作成された VMTemplate をデプロイできます。次の構文を使用すると、指定した VMTemplate から同じ場所に新しい仮想マシンを作成できます。
VMTemplate Deploy -p <Full file path of vmtx file of existing VM template>
vmcli を使用して新しい仮想マシンを作成する
次の構文を使用して、新しい仮想マシンを作成できます。
VM Create -n <vm name> -d <path where vm will be created> -g <guest operating system>
VM Create -n myVM -d ~/Desktop/ -g windows9-64
仮想マシンを作成して ISO を接続する例
次の手順を実行した後、新しく作成した仮想マシンを仮想マシン ライブラリに追加してから、仮想マシンをパワーオンして、ISO ファイルを使用してゲストのインストール プロセスを開始できます。次の例の構文を使用できます。
echo "----creating VM-----" vmcli VM Create -n windowstest -d ~/Desktop/test -g windows9-64 vmcli ConfigParams SetEntry displayName "windowstest" ~/Desktop/test/windowstest.vmx echo "----create Nvme vmdk related things-----" vmcli nvme SetPresent nvme0 1 ~/Desktop/test/windowstest.vmx vmcli Disk SetBackingInfo nvme0:0 disk windowstest.vmdk 1 ~/Desktop/test/windowstest.vmx vmcli Disk SetPresent nvme0:0 1 ~/Desktop/test/windowstest.vmx echo "----create sata disk for iso mounting-----" vmcli Sata SetPresent sata0 1 ~/Desktop/test/windowstest.vmx vmcli Disk SetBackingInfo sata0:0 cdrom_image ~/Documents/iso/22621.1.220506-1250.ni_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso 1 ~/Desktop/test/windowstest.vmx vmcli Disk SetPresent sata0:0 1 ~/Desktop/test/windowstest.vmx echo "----create ethernet related things-----" vmcli Ethernet query ~/Desktop/test/windowstest.vmx vmcli Ethernet SetVirtualDevice ethernet0 vmxnet3 ~/Desktop/test/windowstest.vmx vmcli Ethernet SetConnectionType ethernet0 nat ~/Desktop/test/windowstest.vmx vmcli Ethernet SetAddressType ethernet0 generated "" ~/Desktop/test/windowstest.vmx vmcli Ethernet SetLinkStatePropagation ethernet0 true ~/Desktop/test/windowstest.vmx vmcli Ethernet SetPresent ethernet0 1 ~/Desktop/test/windowstest.vmx vmcli ConfigParams SetEntry bios.bootOrder "cdrom,hdd" ~/Desktop/test/windowstest.vmx echo "---------Done-------"