hiroの長い冒険日記

主にコンピュータ周辺の興味を持った内容を綴ります

Hyper-V仮想マシンを command line で起動する

当日記ではアフィリエイト広告を利用しています

マイナビ Windows10 Mini Tips より。
news.mynavi.jp
ショートカットと言いつつ、command line からも起動できそう。WSL もそうだが、command line 強化が進むのは好ましい。

WSL Ubuntu を管理者として実行して、試してみた。

$ vmconnect.exe 127.0.0.1 "debian_test" &
[1] 51
(Hyper-V 仮想マシン接続の Window が開くので起動ボタンを押す)
$ ssh username@192.168.n.n
username@192.168.n.n's password:
Linux debian 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Feb  3 17:31:50 2019 from 192.168.n.n
username@debian:~$ su -
Password:
root@debian:~# shutdown -h now
Connection to 192.168.n.n closed by remote host.
Connection to 192.168.n.n closed.
$

WSL から仮想マシンを起動して ssh で login し、作業が終わったら shutdown して終了させる、とか便利。