Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

How it works...

In step 1, you mount the Windows Server installation ISO file:

In step 2, you store the drive letter for the mounted ISO file:

In step 3 and step 4, you get the path to the NanoServerImageGenerator module folder within the installation media and review the contents:

In step 5, you import the module and view the commands it contains:

In step 6 to step 8 you define the variables and paths for the new Nano Server VM:

In step 9, you create the Nano Server image, and you provide the administrator password when prompted.

Monitor the progress bar as the cmdlet builds the image:

In step 10, you store the name of the Hyper-V switch to which you connect your new Nano Server. If you have defined more than one switch, this recipe returns the first switch found—you may need to adjust this step depending on your configuration. The output looks like this::

In step 11, you create the VM in Hyper-V, referring to the newly created VHDX file.

In step 12, you start your new VM.