ネットワーキング
 Computer >> コンピューター >  >> ネットワーキング >> ネットワーキング

PowerShellを使用したHyper-V2019での仮想マシンの作成

以前の記事の1つですでに述べたように、仮想マシンはGUI(グラフィカルユーザーインターフェイス)またはPowerShellを使用して作成できます。ほとんどの場合、両方のオプションを利用できる場合、IT管理者はGUIを使用することを好みます。

この記事では、PowerShellを使用してHyper-V2019で仮想マシンを作成する方法を紹介します。ご存知かもしれませんが、PowerShellはWindowsクライアントとWindowsサーバーのオペレーティングシステムに統合されたツールです。これは、特定のコマンドを実行するために使用される何千ものコマンドレットで構成されています。

いつものように、手順を説明するために、シナリオを作成します。 Windows Server2019で役割としてHyper-V2019を実行しています。WindowsServer2019をホストし、8GBのRAMと50GBのディスクスペースを備えた仮想マシンを作成したいと考えています。それでは、始めましょう。

  1. 左クリック スタートメニュー PowerShellと入力します
  2. 右クリック PowerShell 次に、[管理者として実行]をクリックします
  3. [はい]をクリックします 管理者としてPowerShellを実行していることを確認する
  4. タイプ 以下のコマンドをPowerShellに入力し、 Enterを押します。 仮想マシンを作成します。仮想マシンの名前と、仮想マシンを保存する場所を定義する必要があります。この場合、名前はWinSrv2019で、場所はパーティションE:\VirtualMachines\。
    New-VM -Name WinSrv2019 -MemoryStartupBytes 8GB -BootDevice VHD -NewVHDPath 
    
    E:\VirtualMachines\WinSrv2019.vhdx -Path E:\VirtualMachines -NewVHDSizeBytes 50GB -Generation 2 -Switch LAN
  5. PowerShellを使用したHyper-V2019での仮想マシンの作成
  6. 実行したコマンドを理解するために、それらの意味を簡単に説明します。
    -New-VM – used to create a new virtual machine.
    
    -Name WinSrv2019 – used o define the name of the virtual machine. In our case the name is WinSrv2019
    
    -MemoryStartupBytes 8 GB – assigned RAM memory to the virtual machine
    
    -BootDevice VHD -NewVHDPath E:\VirtualMachines\WinSrv2019.vhdx – used to create a new virtual hard disk (*.vhdx) on the certain location and declare it as a boot device
    
    -Path E:\VirtualMachines -NewVHDSizeBytes 50GB – used to define the location where we will store newly created disk and what is total capacity. In this case, the capacity is 50 GB.
    
    Generation 2 – define if we will use Generation 1 or Generation 2 VMs. Nowadays it is recommended to use Generation 2.
    
    -Switch LAN – used to define which virtual network switch will be assigned to the virtual machine. In our case the name of the virtual switch is LAN. In the previous article, we explained what are virtual network switches and how to create them. Please check it on the link.
  7. オペレーティングシステムをインストールするために、ISOファイルをVMのCD/DVDドライブにマップします。コマンドは
    Add-VMDvdDrive -VMName WinSrv2019 -Path E:\Software\ISO\WinSrv2019.iso

    PowerShellを使用したHyper-V2019での仮想マシンの作成

  8. 実行したコマンドを理解するために、それらの意味を簡単に説明しましょう。
    Add-VMDvdDrive – create new DVD Drive that will be used as the bootable drive
    
    VMName WinSrv2019 – choose the virtual machine where you would like to add a new DVD drive. In our case the name of the virtual machine is WinSrv2019
    
    -Path E:\Software\ISO\WinSrv2019.iso – choose the location where your ISO file is stored. Please note that you need to download ISO file from the official Microsoft or Linux website and then use it as installation media.
  9. 次のコマンドを入力して仮想マシンを起動します:
    Start-VM -Name WinSrv2019

    PowerShellを使用したHyper-V2019での仮想マシンの作成

  10. VMConnect.exeを入力します 仮想マシン接続を開始するには 。 VMConnectツールは、仮想マシンへの接続に使用されます。
  11. サーバーを選択します および仮想マシン 次に、[ OK]をクリックします 。この場合、サーバーはローカルホストであり、仮想マシンはWinSrv2019です。 PowerShellを使用したHyper-V2019での仮想マシンの作成

  1. Hyper-V2019を使用してVMをある場所から別の場所に移動する

    Hyper-Vと仮想マシンについて書くのが本当に好きだということをご存知でしょう。ただし、その事実に気付いていない場合は、Hyper-V、初期構成、および仮想マシンについて説明した以前の記事をすべて見逃していることになります。最新情報を入手するには、以下の記事を確認してください。 パート1:Hyper-V 2019 Server Coreをインストールするにはどうすればよいですか? パート2:Hyper-V 2019コアサーバー–初期構成 パート3:Hyper-V2019コアリモート管理 パート4:Hyper-V2019で最初の仮想マシンを作成する パート5:Hyper-V2019で

  2. Hyper-V2019での仮想マシンのエクスポートとインポート

    2019年8月に、Hyper-V 2019のインストール、仮想マシンの構成と展開の手順を説明する4つの記事を書きました。これらの記事を見逃した場合は、以下のリンクで読むことができます: パート1:Hyper-V 2019サーバーコアのインストール方法パート2:Hyper-V 2019コアサーバー–初期構成パート3:Hyper-V 2019コアリモート管理パート4: Hyper-V2019で最初の仮想マシンを作成する この記事では、仮想マシンをあるHyper-V2019サーバーから別のHyper-V2019サーバーにエクスポートおよびインポートする方法について説明します。仮想マシン、構成ファ