Batch deployment of Windows Nanoserver with Hyper-V

Source: Internet
Author: User
Tags domain server

Microsoft Nano Server 2016 is deployed using a WIM file and a VHDX file that is generated after package packaging, and you can see 17 related packages from the Nano server folder in the Windows Server ISO image. This section will share if you are generating VHDX images in batches and creating hyper-V virtual machines, install compute, storage, and clustering together and automatically join the Nano server to an existing domain environment.

1. Prerequisites

1.1 The following default packages can be seen under the Nano server folder

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/89/29/wKiom1gJmWywF2GTAAC8X3Q4lOc593.png "title=" 1.png " alt= "Wkiom1gjmwywf2gtaac8x3q4loc593.png"/>

1.2 In this experiment, the ActiveDirectory domain environment and the DHCP server have been configured in advance, and if DHCP is not configured then the network information needs to be specified manually in the script that generates the VHDX image, otherwise the domain failure will occur;

1.3 After the script needs to run on the domain member server, and the current account has the domain permissions, otherwise in the creation of the VHDX process will have the following error (if it happens that your current local account password and domain account password consistent, so even in a workgroup environment can be successfully created domain VHDX)

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/89/29/wKiom1gJmXfgjhcBAABpQ5sYD-k637.png "title=" 2.png " alt= "Wkiom1gjmxfgjhcbaabpq5syd-k637.png"/>

2. Creating a VHDX image

2.1 According to the actual situation, customize the parameters of the script, run Windows PowerShell as an administrator run the following script

#Variables

$ServerEdition = "Datacenter"

$MediaPath = "E:\"

$BasePath = "D:\Base"

$TargetPath = "D:\"

$ServerCount = 4

$MaxSize = 200GB

$ComputerName = "NANO_HV"

$DomainName = "contoso.com"

$AdministratorPassword = "123.com" | convertto-securestring -asplaintext -force

# Import Nano Server Module

Set-executionpolicy remotesigned

Import-module " $MediaPath \NANOSERVER\NANOSERVERIMAGEGENERATOR\NANOSERVERIMAGEGENERATOR.PSD1 "

for ($i=1; $i -le $ServerCount ; $i ++ ){

new-nanoserverimage '

-deploymenttypeGuest '

-edition$ServerEdition '

-mediapath$MediaPath '

-basepath$BasePath '

-targetpath$TargetPath $computername$i. VHDX '

-computername$ComputerName $i '

-domainname$DomainName '

-administratorpassword$AdministratorPassword '

-compute '

-storage '

-clustering '

-maxsize$MaxSize '

-verbose

}

2.2 Script is running, creating VHDX image File

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/89/26/wKioL1gJmYfjxKfHAAN3Vb8Jb_U243.png "title=" 3.png " alt= "Wkiol1gjmyfjxkfhaan3vb8jb_u243.png"/>

2.3 Wait more than 10 minutes after the script completes successfully, without any warning and error

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/89/29/wKiom1gJmZiTn4ogAAO0D3dNk4Y691.png "title=" 4.png " alt= "Wkiom1gjmzitn4ogaao0d3dnk4y691.png"/>

2.4 See the 4 VHDX images that have been generated in the specified destination path

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/89/26/wKioL1gJmabROaizAACORnAATzQ713.png "title=" 5.png " alt= "Wkiol1gjmabroaizaacornaatzq713.png"/>

3. Create a virtual machine

3.1 Customize the batch create VM script as required, run Windows PowerShell as an administrator run the following script

$VMName = "NANO_HV"

$VMPath = "F:\"

$SwitchName = "External"

$MemoryStartupBytes = 1024MB

$ServerCount = 4

for ($i=1; $i -le $ServerCount ; $i ++ )

{

$VHDPath="D:\Nano_HV$i. VHDX"

new-vm '

-name$VMName $i '

-path$VMPath '

-memorystartupbytes$MemoryStartupBytes '

-generation2 '

-vhdpath$VHDPath '

-switchname$SwitchName '

}

3.2 Script run complete in Hyper-V Manager you can see that 4 virtual machines were successfully created

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/89/26/wKioL1gJmbKCi7LTAAAjK89ErgQ758.png "title=" 6.png " alt= "Wkiol1gjmbkci7ltaaajk89ergq758.png"/>

3.3 Run the following command query to create 4 virtual machines, the default is not to turn on nested virtualization

GET-VM *nano_hv* | Get-vmprocessor | Select VMName , exposevirtualizationextensions

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/89/29/wKiom1gJmbzx1trjAAAacIVwvws821.png "title=" 7.png " alt= "Wkiom1gjmbzx1trjaaaacivwvws821.png"/>

3.4 Turn on nested virtualization for virtual machines

GET-VM *nano_hv* | Set-vmprocessor -exposevirtualizationextensions $true

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/89/26/wKioL1gJmcbhJniBAAAZMwoiavc896.png "title=" 8.png " alt= "Wkiol1gjmcbhjnibaaazmwoiavc896.png"/>

3.5 4 Computer objects that are automatically added to the domain after you see ADUC

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/89/26/wKioL1gJmdKw4uClAAFgh1aTdJ8144.png "title=" 9.png " alt= "Wkiol1gjmdkw4uclaafgh1atdj8144.png"/>

4. managing Hyper-V hosts

4.1 We can use Hyper-V Manager for unified management of the Nano Server Hyper-V host, as follows to install the Hyper-V management tool

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/89/29/wKiom1gJmeCR7xnFAADiiRy5oOk874.png "title=" 10.png "alt=" Wkiom1gjmecr7xnfaadiiry5ook874.png "/>

4.2 After the installation is complete, open Hyper-V Manager and right-click on "Connect to Server"

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/89/29/wKiom1gJmeviCeVPAAA_WLL4Tdk566.png "title=" 11.png "alt=" Wkiom1gjmevicevpaaa_wll4tdk566.png "/>

4.3 Select "Another Computer", enter the host name of the Nano server, click "OK"

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/89/26/wKioL1gJmfqQyVldAAAfxH7Ymjc488.png "title=" 12.png "alt=" Wkiol1gjmfqqyvldaaafxh7ymjc488.png "/>

4.4 See successfully added to Hyper-V Manager

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/89/26/wKioL1gJmgaSNvzHAABaRhbcgZ0623.png "title=" 13.png "alt=" Wkiol1gjmgasnvzhaabarhbcgz0623.png "/>

4.5 Similarly add 4 Hyper-V Hosts for unified management

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/89/29/wKiom1gJmhPByf47AACArPdtQk4116.png "title=" 14.png "alt=" Wkiom1gjmhpbyf47aacarpdtqk4116.png "/>

4.6 In the same domain server, open Server Manager, click "ADD Other servers to manage"

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/89/26/wKioL1gJmh-xTxVSAADPagCAZ5Q687.png "title=" 15.png "alt=" Wkiol1gjmh-xtxvsaadpagcaz5q687.png "/>

4.7 Adding a host that needs to be managed centrally

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/89/26/wKioL1gJmirgH31rAAB1XdW_nu8513.png "title=" 16.png "alt=" Wkiol1gjmirgh31raab1xdw_nu8513.png "/>

4.8 After you add the Allservers list in the Server Manager after you finish

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/89/29/wKiom1gJmjehq0UyAAC_x2yAje8411.png "title=" 17.png "alt=" Wkiom1gjmjehq0uyaac_x2yaje8411.png "/>

4.9 These servers can be managed uniformly in this server Manager, such as adding roles and features, running Windows PowerShell, opening Hyper-V Manager, and more

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/89/29/wKiom1gJmkOC5ZXoAADmyLLXIyI839.png "title=" 18.png "alt=" Wkiom1gjmkoc5zxoaadmyllxiyi839.png "/>

4.10 You can also run the following command directly in Windowspowershell to remotely connect to the corresponding Nano server for management

enter-pssession -computername Nano_HV1.contoso.com -credential (get-credential)

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/89/26/wKioL1gJmniiO6rJAACMfxQeFfc917.png-wh_500x0-wm_3 -wmp_4-s_415702431.png "title=" 19.png "alt=" Wkiol1gjmniio6rjaacmfxqeffc917.png-wh_50 "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/89/29/wKiom1gJmmOSg-loAAAunr5ZbZA507.png "title=" 20.png "alt=" Wkiom1gjmmosg-loaaaunr5zbza507.png "/>

The above is about how to bulk deploy Windows Nano server with Hyper-V share, for the domain-added environment is also very simple to achieve centralized management of Nano server, then for the workgroup environment is how to achieve unified management? We will share and communicate later in chapter one by one.


This article is from the "Huang Jinhui column" blog, be sure to keep this source http://stephen1991.blog.51cto.com/8959108/1864198

Batch deployment of Windows Nanoserver with Hyper-V

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.