Windows Server – Tech-Coffee //www.tech-coffee.net Fri, 09 Aug 2019 11:34:26 +0000 en-US hourly 1 https://wordpress.org/?v=5.2.11 65682309 Don’t do it: enable performance history in an Azure Stack HCI mixed mode cluster //www.tech-coffee.net/dont-do-it-enable-performance-history-in-an-azure-stack-hci-mixed-mode-cluster/ //www.tech-coffee.net/dont-do-it-enable-performance-history-in-an-azure-stack-hci-mixed-mode-cluster/#respond Fri, 09 Aug 2019 11:34:16 +0000 //www.tech-coffee.net/?p=6935 Lately I worked for a customer to add two nodes in an existing 2-nodes Storage Spaces Direct cluster. The existing nodes are running on Windows Server 2016 while the new ones are running on Windows Server 2019. So, when I integrated the new nodes to the cluster, it was in mixed operating system mode because ...

The post Don’t do it: enable performance history in an Azure Stack HCI mixed mode cluster appeared first on Tech-Coffee.

]]>
Lately I worked for a customer to add two nodes in an existing 2-nodes Storage Spaces Direct cluster. The existing nodes are running on Windows Server 2016 while the new ones are running on Windows Server 2019. So, when I integrated the new nodes to the cluster, it was in mixed operating system mode because two different versions of Windows Server were in the cluster. For further information about this process, you can read this topic.

After the integration of the new nodes, I left the customer because the data in the cluster were replicated and spread on them. During this period, the customer ran this command:

Start-ClusterPerformanceHistory

This command start performance history in a Storage Spaces Direct cluster. In a native Windows Server 2019 cluster, a cluster shared volume called ClusterPerformanceHistory is created to store performance metrics. Because the cluster were in mixed operating system mode and not in native Windows Server 2019 mode, it resulted in an unexpected behavior. Several ClusterPerformanceHistory CSV were created. Even if they were deleted, new ClusterPerformanceHistory were created indefinitely.

A circuit board

Description automatically generated

The customer tried to run the following cmdlet without success:

Stop-ClusterPerformanceHistory -DeleteHistory

How to resolve the performance history issue

To solve this issue, the customer ran this cmdlets:

$StorageSubSystem = Get-StorageSubSystem Cluster* $StorageSubSystem | Set-StorageHealthSetting -Name “System.PerformanceHistory.AutoProvision.Enabled” -Value “False”

The option System.PerformanceHistory.AutoProvision.Enabled is set to True when the cmdlet Start-ClusterPerformanceHistory is run. However, the cmdlet Stop-ClusterPerformanceHistory doesn’t disable this setting.

The post Don’t do it: enable performance history in an Azure Stack HCI mixed mode cluster appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/dont-do-it-enable-performance-history-in-an-azure-stack-hci-mixed-mode-cluster/feed/ 0 6935
Use Honolulu to manage your Microsoft hyperconverged cluster //www.tech-coffee.net/use-honolulu-to-manage-your-microsoft-hyperconverged-cluster/ //www.tech-coffee.net/use-honolulu-to-manage-your-microsoft-hyperconverged-cluster/#comments Wed, 21 Feb 2018 11:09:19 +0000 //www.tech-coffee.net/?p=6194 Few months ago, I have written a topic about the next gen Microsoft management tool called Honolulu project. Honolulu provides management for standalone Windows Server, failover clustering and hyperconverged. Currently hyperconverged management works only on Windows Server Semi-Annual Channel (SAC) versions (I cross finger for Honolulu support on Windows Server LTSC). I have upgraded my ...

The post Use Honolulu to manage your Microsoft hyperconverged cluster appeared first on Tech-Coffee.

]]>
Few months ago, I have written a topic about the next gen Microsoft management tool called Honolulu project. Honolulu provides management for standalone Windows Server, failover clustering and hyperconverged. Currently hyperconverged management works only on Windows Server Semi-Annual Channel (SAC) versions (I cross finger for Honolulu support on Windows Server LTSC). I have upgraded my lab to latest technical preview of Windows Server SAC to show you how to use Honolulu to manage your Microsoft hyperconverged cluster.

In part of my job, I deployed dozen of Microsoft hyperconverged cluster and to be honest, the main disadvantage of this solution is the management. Failover Clustering console is archaic and you have to use PowerShell to manage the infrastructure. Even if the Microsoft solution provides high-end performance and good reliability, the day-by-day management is tricky.

Thanks to Honolulu project we have now a modern management which can compete with other solutions on the market. Currently Honolulu is still in preview version and some of features are not yet available but it’s going to the right direction. Moreover, Honolulu project is free and can be installed on your laptop or on a dedicated server. As you wish !

Honolulu dashboard for hyperconverged cluster

Once you have added the cluster connection to Honolulu, you get a new line with the type Hyper-Converged Cluster. By clicking on it, you can access to a dashboard.

This dashboard provides a lot of useful information such as latest alerts provided by the Health Service, the overall performance of the cluster, the resource usage and information about servers, virtual machines, volumes and drives. You can see that currently the cluster performance charts indicate No data available. It is because the Preview of Windows Server that I have installed doesn’t provide information yet.

From my point of view, this dashboard is pretty clear and provides global information about the cluster. At a glance, you get the overall health of the cluster.

N.B: the memory usage indicated -35,6% because of a custom motherboard which not provide memory installed on the node.

Manage Drives

By clicking on Drives, you get information about the raw storage of your cluster and your storage devices. You get the total drives (I know I don’t follow the requirements because I have 5 drives on a node and 4 on another, but it is a lab ). Honolulu provides also the drive health and the raw capacity of the cluster.

By clicking on Inventory, you have detailed information about your drives such as the model, the size, the type, the storage usage and so on. At a glance, you know if you have to run an Optimize-StoragePool.

By clicking on a drive, you get further information about it. Moreover, you can act on it. For example, you can turn light on, retire the disk or update the firmware. For each drive you can get performance and capacity charts.

Manage volumes

By clicking on Volumes, you can get information about your Cluster Shared Volume. At a glance you get the health, the overall performance and the number of volumes.

In the inventory, you get further information about the volumes such as the status, the file system, the resiliency, the size and the storage usage. You can also create a volume.

By clicking on create a new volume, you get this:

By clicking on a volume, you get more information about it and you can make action such as open, resize, offline and delete.

Manage virtual machines

From Honolulu, you can also manage virtual machines. When you click on Virtual Machines | Inventory, you get the following information. You can also manage the VMs (start, stop, turn off, create a new one etc.). All chart values are in real time.

vSwitches management

From the Hyper-Converged cluster pane, you have information about virtual switches. You can create a new one, delete rename and change settings of an existing one.

Node management

Honolulu provides also information about your nodes in the Servers pane. At a glance you get the overall health of all your nodes and resource usage.

In the inventory, you have further information about your nodes.

If you click on a node, you can pause the node for updates or hardware maintenance. You have also detailed information such as performance chartsm drives connected to the node and so on.

Conclusion

Project Honolulu is the future of Windows Server in term of management. This product provides great information about Windows Server, Failover Clustering and Hyperconverged cluster in a web-based form. From my point of view, Honolulu eases the Microsoft hyperconverged solution management and can help administrators. Some features are missing but Microsoft listen the community. Honolulu is modular because it is based on extensions. Without a doubt, Microsoft will add features regularly. Just I cross finger for Honolulu support on Windows Server 2016 released in October 2016 but I am optimistic.

The post Use Honolulu to manage your Microsoft hyperconverged cluster appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/use-honolulu-to-manage-your-microsoft-hyperconverged-cluster/feed/ 1 6194
The cluster resource could not be deleted since it is a core resource //www.tech-coffee.net/the-cluster-resource-could-not-be-deleted-since-it-is-a-core-resource/ //www.tech-coffee.net/the-cluster-resource-could-not-be-deleted-since-it-is-a-core-resource/#comments Tue, 16 Jan 2018 15:50:51 +0000 //www.tech-coffee.net/?p=6069 The last month, I wanted to change the Witness of a cluster from a Cloud Witness to a File Share Witness. The cluster is a 2-node S2D cluster and as discussed with Microsoft, Cloud Witness should not be used with a 2-node cluster. If the Cloud Witness fails (for example when subscription has expired), the ...

The post The cluster resource could not be deleted since it is a core resource appeared first on Tech-Coffee.

]]>
The last month, I wanted to change the Witness of a cluster from a Cloud Witness to a File Share Witness. The cluster is a 2-node S2D cluster and as discussed with Microsoft, Cloud Witness should not be used with a 2-node cluster. If the Cloud Witness fails (for example when subscription has expired), the cluster can crashes. I’ve experienced this in production. So, all my customers, I decided to change the cloud witness to file share witness.

Naivly, I tried to change the Cloud Witness to a File Share witness. But it doesn’t work 🙂 You’ll get this message: The cluster resource could not be deleted since it is a core resource. In this topic I’ll show you the issue and the resolution

Issue

As you can see below, my cluster is using a Cloud Witness to add an additional vote.

So, I decide to replace the Cloud Witness by a File Share Witness. I right click on the cluster | more Actions | Configure Cluster Quorum Settings.

Then I choose Select the quorum witness.

I select configure a file share witness.

I specify the file share path as usual.

To finish I click next and it should replace the cloud witness by the file share witness.

Actually no, you should get the following error message.

If you check the witness state, it is offline.

This issue occurs because we can’t remove cluster core resources. So how I remove the Cloud Witness?

Resolution

To remove the Cloud Witness, choose again to configure the cluster quorum and this time select Advanced Quorum Configuration.

Then select Do not configure a quorum witness.

Voilà, the Cloud Witness is gone. No you can add the File Share Witness.

In the below screenshot you can see the configuration to add a file share witness to the cluster.

Now the file share witness is added to the cluster.

Conclusion

If you want to remove a Cloud Witness or a File Share Witness, you have first to not configure a witness for the quorum. Then you can add the witness type you want.

The post The cluster resource could not be deleted since it is a core resource appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/the-cluster-resource-could-not-be-deleted-since-it-is-a-core-resource/feed/ 14 6069
Next gen Microsoft management tool: Honolulu //www.tech-coffee.net/next-gen-microsoft-management-tool-honolulu/ //www.tech-coffee.net/next-gen-microsoft-management-tool-honolulu/#respond Mon, 25 Sep 2017 06:10:47 +0000 //www.tech-coffee.net/?p=5791 Since the beginning of the year, Microsoft is working on a new management tool based on modern web languages such as HTML5, Angular and so on. This tool is called Honolulu. Honolulu is a user-friendly web interface that enables to manage Windows Server, Failover Clustering and Hyperconverged cluster. Currently, to manage hyperconverged cluster, Honolulu requires ...

The post Next gen Microsoft management tool: Honolulu appeared first on Tech-Coffee.

]]>
Since the beginning of the year, Microsoft is working on a new management tool based on modern web languages such as HTML5, Angular and so on. This tool is called Honolulu. Honolulu is a user-friendly web interface that enables to manage Windows Server, Failover Clustering and Hyperconverged cluster. Currently, to manage hyperconverged cluster, Honolulu requires Semi-Annual Windows Server release.

Honolulu is currently in public preview release which means that the product is under construction :). Honolulu is built in a modular way where you can add or remove extensions. Each management feature is included in an extension that you can add or remove. Microsoft expects later that vendors develop third party extensions. To be honest with you, this is the set of tools I’m waiting for a while ago. Microsoft was in late in management tools compared to other companies such as VMware. I hope that Honolulu will close the gap with VMware vCenter and Nutanix Prism.

Microsoft listens customers and feedback to improve this product. So you can download the product here and report feedback in this user voice.

In this topic, we will see an overview of Honolulu. I’ll dedicate a topic about Honolulu and Microsoft hyperconverged solution because Honolulu requires Windows Server 2016 RS3 release (in Semi-Annual Channel) to work with and I have not yet upgraded my lab.

Getting started with Honolulu

In the below screenshot, you can see Honolulu home page. You get all your connections (and the type) and you can add more of them.

By clicking on arrow next to Project Honolulu, you can filter the connection type on Server Manager, Failover Cluster Manager and Hyper-Converged Cluster Manager.

By clicking on the wheel (top right), you can access to extension manager and you get installed extensions. For example you have extensions for firewall management, Hyper-V, failover clustering and so on. You can remove extensions you don’t want.

Sever Manager

As you have seen before, you can manage a single server from Honolulu. I will not show you all management tools but just an overview of Honolulu. By adding and connecting to a server, you get the following dashboard. In this dashboard you can retrieve real-time metrics (CPU, memory and network) and information, you can restart or shutdown the system or edit RDP access and environment variables. For the moment you can’t resize columns and tables and I think in near future that Microsoft will add this feature.

An interesting module is the Events. In this pane, you get the same thing as this good old Event Viewer. You can retrieve all the events of your system and you can filter them. Maybe a checkbox enabling real-time events could be interesting :).

The devices pane is also available. In a single view, you have all hardware installed in the system. If Microsoft adds the ability to install drivers from there, Honolulu can replace DevCon for Core servers.

You can also browse the system files and manage file and folders.

Another pane enables to manage the network adapters as you can see below. For the moment this pane is limited because it doesn’t allow to manage advanced feature such as RDMA, RSS, VMMQ and so on.

You can also add or remove roles and features from Honolulu. It is really cool that you can manage this from a Web service.

If you use Hyper-V, you can manage VMs from Honoulu. The dashboard also is really nice because there is counters about VMs and last events.

Another super cool feature is the ability to manage updates from Honolulu. I hope Microsoft will add WSUS configuration from this pane with some scheduling.

Failover Cluster management

Honolulu enables also to manage failover cluster. You can add a failover cluster connection from Honolulu home page. Just click on Add.

Then specify the cluster name. Honolulu asks if you want to add also the servers member of the cluster.

One it is added, you can select it and you get this dashboard. You get cluster core ressource states, and some information about the cluster such as the number of roles, networks and disks.

By clicking on disks, you can get a list of Cluster Shared Volumes in the cluster and information about them.

If your cluster hosts Hyper-V VMs (not in hyperconverged way), you can manage VMs from there. You get the same pane than in Honolulu server manager. The VMs and related metrics are shown and you can create or delete virtual machines. A limited set of option is currently available.

You can also get the vSwitches deployed in each node. It’s pitty that Switch Embedded Teaming is not yet supported but I think the support will be added later.

Hyperconverged cluster management

As I said earlier, hyperconverged cluster is supported but only for Windows Server Semi-Annual channel (for the moment). I’ll dedicate a topic about Honolulu and hyperconverged cluster once I’ll upgrade my lab.

Update Honolulu

When a Honolulu update is released, you get notified by Update Available mention. Currently, the update process is not really user-friendly because when you click on Update Available, an executable is downloaded and you have to run again the Honolulu installation (specify installation path, certificate thumbprint etc.). I hope in the future that the update process will be a self-update.

When I have downloaded the executable, I checked the package size and it is amazing: only 31MB.

Conclusion

Finally, they did it! A true modern management tool. I try for Microsoft this tool for 3 months and I can say you that developers work really quickly and they make a great job. Features are added quickly and Microsoft listens customers. I recommend you to post in the user voice the features you want. The tool is currently not perfect, some features are missing but Honolulu is still in preview release ! Microsoft is in the right direction with Honolulu and I hope this tool will be massively used. I hope also that Honolulu will help to install more Windows Server in Core edition, especially for Hyper-V and storage server.

The post Next gen Microsoft management tool: Honolulu appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/next-gen-microsoft-management-tool-honolulu/feed/ 0 5791
Update Mellanox network adapter firmware //www.tech-coffee.net/update-mellanox-network-adapter-firmware/ //www.tech-coffee.net/update-mellanox-network-adapter-firmware/#respond Wed, 06 Sep 2017 06:57:23 +0000 //www.tech-coffee.net/?p=5721 Like the others, Mellanox network adapters should be updated to the latest firmware to solve issues. When you download the Mellanox firmware release note, you can see how much reported issues have been solved (usually, a lot :)). Mellanox provides tools to update and manage the firmware from Linux, Freebsd, VMware ESXi, Windows and Windows ...

The post Update Mellanox network adapter firmware appeared first on Tech-Coffee.

]]>
Like the others, Mellanox network adapters should be updated to the latest firmware to solve issues. When you download the Mellanox firmware release note, you can see how much reported issues have been solved (usually, a lot :)). Mellanox provides tools to update and manage the firmware from Linux, Freebsd, VMware ESXi, Windows and Windows PE. Thanks to this set of tools, you can update Mellanox network adapter firmware from a powered-up operating system. In this topic, we will see how to manage the firmware from Windows Server 2016 Datacenter Core and from VMware ESXi 6.5u1.

This topic shows you how to update Mellanox network adapter from Mellanox. If you have a branded Mellanox network adapter (Dell, IBM etc.), please check the related documentation from the vendor.

Requirements

First, you need to identify which Mellanox network adapter is installed on your system. You can retrieve this information from a sticker on the network adapter or from invoice. In my lab, I have two Mellanox model:

  • ConnectX3-Pro (MCX312B-XCCT)
  • ConnectX3 (MCX312A-XCBT)

N.B: If you can’t get the model of the network adapter, run mlxfwmanager when the Mellanox tools will be deployed. Then retrieve the PSID information and make a search on Google.

Once you have identified the network adapter model, you can download the firmware from Mellanox. Usually I type in Google “Firmware MCX312B-XCCT” for example. Then I can get this webpage from Mellanox and I can download and unzip the firmware.

You need also the Mellanox toolset called Mellanox Firmware Tools (MST). You can get the documentation from this location. If you need to update firmware from VMware ESXi 6.5u1, download the two VIB files as below:

If you plan to update firmware from Windows Server, download the following executable:

Update firmware from VMware ESXi

First, we need to install MST on ESXi. A reboot is required. I recommend you to place your server in maintenance mode. From vCenter or ESXi web interface, upload in a datastore the firmware and VIB files.

Then open a SSH session and navigate to /vmfs/volumes/<your datastore>. Copy the path with the datastore ID as below:

Then install both VIB files with the command esxcli software vib install -v <path to vib file>:

Then reboot the server. Once you have rebooted the server, you can navigate to /opt/mellanox/bin. The command /opt/Mellanox/bin/mst status gives you the installed Mellanox device.

Then you can flash your device by specifying /opt/Mellanox/bin/flint -d <device> -I <path to firmware file> burn

After the firmware is updated on Mellanox network adapter, you need to reboot your server again. If you open Flexboot (CtRL+B at startup), you can see the new version. You can also use /opt/Mellanox/bin/mlxfwmanager to get this information.

Update firmware from Windows Server

I recommend you to place your node in pause state because a reboot is required. On the MST web page, download the Windows executable as indicated in the following screenshot:

Copy the executable on the server and run the installation. Once MST is installed, navigate to C:\Program Files\Mellanox\WinMFT. You can run mst status to get information about installed Mellanox network adapter:

Then you can run flint -d <Device> -I <path to firmware> burn

As you can see, after the firmware is updated, the new version is not active (you can use mlxfwmanager.exe to get these information). You need to reboot the server in order to use the new firmware version.

After a reboot, you can see that the new version is the only one.

Force to change the PSID to remove vendor custom firmware

There is a chance to brick your network adapter! I’m not responsible in case of hardware degradation.

Recently, I bought on eBay a ConnectX3 from Mellanox with a IBM PSID. I wanted to flash the firmware with a Mellanox image. To make this change, I run /opt/Mellanox/bin/flint -d <device> -i <path to firmware> -allow_psid_change burn. Then flint asked me if I really want to change the PSID because it is not recommended.

After a reboot, I checked from /opt/Mellanox/bin/mlxfwmanager and the PSID was changed.

The post Update Mellanox network adapter firmware appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/update-mellanox-network-adapter-firmware/feed/ 0 5721
Understand Failover Cluster Quorum //www.tech-coffee.net/understand-failover-cluster-quorum/ //www.tech-coffee.net/understand-failover-cluster-quorum/#comments Tue, 17 Nov 2015 10:22:02 +0000 //www.tech-coffee.net/?p=4274 This topic aims to explain the Quorum configuration in a Failover Clustering. As part of my job, I work with Hyper-V Clusters where the Quorum is not well configured and so my customers have not the expected behavior when an outage occurs. I work especially on Hyper-V clusters but the following topic applies to most ...

The post Understand Failover Cluster Quorum appeared first on Tech-Coffee.

]]>
This topic aims to explain the Quorum configuration in a Failover Clustering. As part of my job, I work with Hyper-V Clusters where the Quorum is not well configured and so my customers have not the expected behavior when an outage occurs. I work especially on Hyper-V clusters but the following topic applies to most of Failover Cluster configuration.

What’s a Failover Cluster Quorum

A Failover Cluster Quorum configuration specifies the number of failures that a cluster can support in order to keep working. Once the threshold limit is reached, the cluster stops working. The most common failures in a cluster are nodes that stop working or nodes that can’t communicate anymore.

Imagine that quorum doesn’t exist and you have two-nodes cluster. Now there is a network problem and the two nodes can’t communicate. If there is no Quorum, what prevents both nodes to operate independently and take disks ownership on each side? This situation is called Split-Brain. Quorum exists to avoid Split-Brain and prevents corruption on disks.

The Quorum is based on a voting algorithm. Each node in the cluster has a vote. The cluster keeps working while more than half of the voters are online. This is the quorum (or the majority of votes). When there are too many of failures and not enough online voters to constitute a quorum, the cluster stop working.

Below this is a two nodes cluster configuration:

The majority of vote is 2 votes. So a two nodes cluster as above is not really resilient because if you lose a node, the cluster is down.

Below a three-node cluster configuration:

Now you add a node in your cluster. So you are in a three-node cluster. The majority of vote is still 2 votes. But because there is three nodes, you can lose a node and the cluster keep working.

Below a four-node cluster configuration:

Despite its four nodes, this cluster can support one node failure before losing the quorum. The majority of vote is 3 votes so you can lose only one node.

On a five-node cluster the majority of votes is still 3 votes so you can lose two nodes before than the cluster stop working and so on. As you can see, the majority of nodes must remain online in order to the cluster keeps working and this is why it is recommended to have an odd majority of votes. But sometimes we want only a two-node cluster for some application that don’t require more nodes (as Virtual Machine Manager, SQL AlwaysOn and so on). In this case we add a disk witness, a file witness or in Windows Server 2016, a cloud Witness.

Failover Cluster Quorum Witness

As said before, it is recommended to have an odd majority of votes. But sometimes we don’t want an odd number of nodes. In this case, a disk witness, a file witness or a cloud witness can be added to the cluster. This witness too has a vote. So when there are an even number of nodes, the witness enables to have an odd majority of vote. Below, the requirements and recommendations of each Witness type (except Cloud Witness):

Witness type Description Requirements and recommendations
Disk witness
  • Dedicated LUN that stores a copy of the cluster database
  • Most useful for clusters with shared (not replicated) storage
  • Size of LUN must be at least 512 MB
  • Must be dedicated to cluster use and not assigned to a clustered role
  • Must be included in clustered storage and pass storage validation tests
  • Cannot be a disk that is a Cluster Shared Volume (CSV)
  • Basic disk with a single volume
  • Does not need to have a drive letter
  • Can be formatted with NTFS or ReFS
  • Can be optionally configured with hardware RAID for fault tolerance
  • Should be excluded from backups and antivirus scanning
File share witness
  • SMB file share that is configured on a file server running Windows Server
  • Does not store a copy of the cluster database
  • Maintains cluster information only in a witness.log file
  • Most useful for multisite clusters with replicated storage
  • Must have a minimum of 5 MB of free space
  • Must be dedicated to the single cluster and not used to store user or application data
  • Must have write permissions enabled for the computer object for the cluster name

The following are additional considerations for a file server that hosts the file share witness:

  • A single file server can be configured with file share witnesses for multiple clusters.
  • The file server must be on a site that is separate from the cluster workload. This allows equal opportunity for any cluster site to survive if site-to-site network communication is lost. If the file server is on the same site, that site becomes the primary site, and it is the only site that can reach the file share.
  • The file server can run on a virtual machine if the virtual machine is not hosted on the same cluster that uses the file share witness.
  • For high availability, the file server can be configured on a separate failover cluster.

So below you can find again a two-nodes Cluster with a witness:

two-nodes-witness

Now there is a witness, you can lose a node and keep the quorum. Even if a node is down, the cluster still working. So when you have an even number of nodes, the quorum witness is required. But to keep an odd majority of votes, when you have an odd number of nodes, you should not implement a quorum witness.

Quorum configuration

Below you can find the four possible cluster configuration (taken from TechNet):

  • Node Majority (recommended for clusters with an odd number of nodes)
    • Can sustain failures of half the nodes (rounding up) minus one. For example, a seven node cluster can sustain three node failures.
  • Node and Disk Majority (recommended for clusters with an even number of nodes).
    • Can sustain failures of half the nodes (rounding up) if the disk witness remains online. For example, a six node cluster in which the disk witness is online could sustain three node failures.
    • Can sustain failures of half the nodes (rounding up) minus one if the disk witness goes offline or fails. For example, a six node cluster with a failed disk witness could sustain two (3-1=2) node failures.
  • Node and File Share Majority (for clusters with special configurations)
    • Works in a similar way to Node and Disk Majority, but instead of a disk witness, this cluster uses a file share witness.
    • Note that if you use Node and File Share Majority, at least one of the available cluster nodes must contain a current copy of the cluster configuration before you can start the cluster. Otherwise, you must force the starting of the cluster through a particular node. For more information, see “Additional considerations” in Start or Stop the Cluster Service on a Cluster Node.
  • No Majority: Disk Only (not recommended)
    • Can sustain failures of all nodes except one (if the disk is online). However, this configuration is not recommended because the disk might be a single point of failure.

Stretched Cluster Scenario

Unfortunately (I don’t like stretched cluster in Hyper-V scenario), some customers have stretched cluster between two datacenters. And the most common mistake I see to save money is the below scenario:

So the customer tells me: Ok I’ve followed the recommendation because I have four nodes in my cluster but I have added a witness to obtain an odd majority of votes. So let’s start the production. The cluster is running for a while and then one day the room 1 is underwater. So you lose Room 1:

In this scenario you should have also a stretched storage and so if you have implemented a disk witness it should move to room 2. But in the above case you have lost the majority of votes and so the cluster stop working (sometimes with some luck, the cluster is still working because the disk witness has time to failover but it is lucky). So when you implement a stretched cluster, I recommend the below scenario:

In this scenario, even if you lose a room, the cluster still working. Yes I know, three rooms are expensive but I have not recommended you to make a stretched cluster J (Hyper-V case). Fortunately, in Windows Server 2016, the quorum witness can be hosted in Microsoft Azure (Cloud Witness).

Dynamic Quorum (Windows Server 2012 feature)

Dynamic Quorum enables to assign vote to node dynamically to avoid to lose the majority of votes and so the cluster can run with one node (known as last-man standing). Let’s take the above example with four-node cluster without quorum witness. I said that the Quorum is 3 votes so without dynamic quorum, if you lose two nodes, the cluster is down.

Now I enable the Dynamic Quorum. The majority of votes is computed automatically related to running nodes. Let’s take again the Four-Node example:

So, why implementing a witness, especially for stretched cluster? Because Dynamic Quorum works great when the failure are sequential and not simultaneous. So for the stretched cluster scenario, if you lose a room, the failure is simultaneous and the dynamic quorum has not the time to recalculate the majority of votes. Moreover I have seen strange behavior with dynamic quorum especially with two-node cluster. This is why in Windows Server 2012, I always disabled the dynamic quorum when I didn’t use a quorum witness.

The dynamic quorum has been enhanced in Windows Server 2012 R2. Now there is the Dynamic Witness implemented. This feature calculate if the Quorum Witness has a vote. There is two cases:

  • If there is an even number of node in the cluster with the dynamic quorum enabled, the Dynamic Witness is enabled on the Quorum Witness and so the witness has vote.
  • If there is an odd number of node in the cluster with the dynamic quorum enabled, the Dynamic Witness is enabled on the Quorum Witness and so the witness has not vote.

So since Windows Server 2012 R2, Microsoft recommends to always implement a witness in a cluster and let the dynamic quorum to decide for you.

The Dynamic Quorum is enabled by default since Windows Server 2012. In the below example, there is a four-node cluster on Windows Server 2016. But it is the same behavior.

I verify if the dynamic quorum is enabled and also the dynamic witness:

The Dynamic Quorum and the Dynamic Witness are well enabled. Because I have four nodes, the Witness has a vote and this is why the Dynamic Witness is enabled. If you want to disable the Dynamic Quorum you can run this command:

(Get-Cluster).DynamicQuorum = 0

To finish, Microsoft has enhanced the dynamic quorum by adjusting the number of online node’s vote to keep an odd number of votes. First the cluster plays with the dynamic witness to keep an odd majority of votes. Then if it can’t adjust the number of vote with the dynamic witness, it remove a vote on a running node.

For example you have a four-node cluster in a streched cluster. You have lost your quorum witness. Now you have two nodes in the room one and two nodes in the room two. The cluster will remove a vote on a node to keep a majority in a room. In this way, even if you lose a node, the cluster still working.

Cloud Quorum Witness (Windows Server 2016 feature)

By implementing a Cloud Quorum Witness, you avoid to spend money on a third room in case of stretched cluster. Below this is the scenario:

The Cloud Witness, hosted in Microsoft Azure, has also one vote. In this way you have also an odd majority of votes. For that you need an existing storage account in Microsoft Azure. You need also an access key.

Now you have just to configure the quorum as a standard witness. Select Configure a Cloud Witness when it is asked.

Then specify the Azure Storage Account and a storage key.

At the end of the configuration, the Cloud Witness should be online.

Conclusion

In conclusion I recommend this when you configure a Quorum in a failover cluster:

  • Prior to Windows Server 2012 R2, always keep an odd majority of vote
    • In case of an even number of nodes, implement a witness
    • In case of an odd number of nodes, do not implement a witness
  • Since Windows Server 2012 R2, Always implement a quorum witness
    • Dynamic Quorum manage the assigned vote to the nodes
    • Dynamic Witness manage the assigned vote to the Quorum Witness
  • In case of stretched cluster, implement the witness in a third room or use Microsoft Azure.

The post Understand Failover Cluster Quorum appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/understand-failover-cluster-quorum/feed/ 28 4274
Deploy and add Network Controller to Virtual Machine Manager //www.tech-coffee.net/deploy-and-add-network-controller-to-virtual-machine-manager/ //www.tech-coffee.net/deploy-and-add-network-controller-to-virtual-machine-manager/#comments Fri, 21 Aug 2015 13:15:12 +0000 //www.tech-coffee.net/?p=3792 Network Controller is a new feature which will be available with Windows Server 2016. This feature enables to manage centrally the virtual and the physical network infrastructure to automate the management, configuration monitoring and troubleshooting. After a quick overview about network controller, I’ll explain how to deploy network controller and how to connect it to ...

The post Deploy and add Network Controller to Virtual Machine Manager appeared first on Tech-Coffee.

]]>
Network Controller is a new feature which will be available with Windows Server 2016. This feature enables to manage centrally the virtual and the physical network infrastructure to automate the management, configuration monitoring and troubleshooting. After a quick overview about network controller, I’ll explain how to deploy network controller and how to connect it to Virtual Machine Manager.

Network Controller overview

The information and schemas of this section come from here.

Network Controller is a Windows Server 2016 server role which is highly available and scalable. This feature comes with two API:

  • The Southbound API enables to discover devices, detect services configuration and gather network information
  • The Northbound API enables to configure, monitor, troubleshoot and deploy new devices (by REST endpoint or a management application as VMM)

Network Controller is able to manage the following network devices or features :

  • Hyper-V VMs and virtual switches
  • Physical network switches
  • Physical network routers
  • Firewall software
  • VPN gateways (including RRaS)
  • Load Balancers

For more information about Network Controller features you can read this topic (section network controller features)

Deploy Network Controller

Requirements

  • A server (VM or not) running on Windows Server 2016 Technical Preview 3 Datacenter;
  • A valid certificate for this server (Server Authentication);

Create Security groups

First, two security groups are required:

  • The first give permissions to configure Network Controller (GG-NetControllerAdmin);
  • The second enables to configure and manage the network by using the network controller (by using REST) (GG-NetControllerRESTAdmin)

Install Network controller feature

To install network controller features, run the following commands:

Install-WindowsFeature -Name NetworkController –IncludeManagementTools
Install-WindowsFeature -Name Windows-Fabric –IncludeManagementTools
Restart-Computer

Once the computer has rebooted, you can open the Server Manager and check if Network Controller is present:


Configure Network Controller

To understand commands and parameters, I recommend you to read this topic.

Currently in Technical Preview 3, the network controller role doesn’t support multi-node cluster. This is why in the following configuration, only one node will be added to the cluster. First I create a node object by using New-NetworkControllerNodeObject cmdlet.

Next I configure the network controller cluster by using the Install-NetworkControllerCluster cmdlet. I specify the node object, an authentication method and the security group that will be able to manage the network controller.

Then I configure network controller by using Install-NetworkController cmdlet. I specify also the node object, the authentication method for the clients and the security group that will be able to configure and manage network from Network Controller (by using REST).

To finish, I verify if my network controller is well configured, run the following commands:

Now that network controller is set and we can connect it to Virtual Machine Manager.

Add network controller to Virtual Machine Manager

To add Network Controller to VMM, you need VMM technical Preview 3.

Open the VMM console and navigate to Fabric. Right click on Network Services and select Add Network Service. Then specify the network service name.

Next select Microsoft as Manufacturer and Microsoft Network Controller as Model.

Then select your RunAs account.

Next specify ServerURL= and the REST Endpoint address. When Network Controller will support multi-node cluster, the SouthBound API address parameter will be mandatory.

Then select the certificate and check the box to specify that certificates have been reviewed.

Next, run Scan provider and verify that information can be gathered as below.

Next select host groups for which the network controller will be available.

When the network controller is added successfully, it should be listed in network services as below.

The post Deploy and add Network Controller to Virtual Machine Manager appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/deploy-and-add-network-controller-to-virtual-machine-manager/feed/ 8 3792
Upgrade Virtual Machine Manager 2012 R2 in High Availability to Technical Preview 2 //www.tech-coffee.net/upgrade-virtual-machine-manager-2012-r2-in-high-availability-to-technical-preview-2/ //www.tech-coffee.net/upgrade-virtual-machine-manager-2012-r2-in-high-availability-to-technical-preview-2/#respond Sat, 15 Aug 2015 13:58:46 +0000 //www.tech-coffee.net/?p=3770 Currently the last build for the next release of Virtual Machine Manager is the Technical Preview 2 (maybe Technical Preview 3 in the end of the month). In this topic, I will explain how to upgrade Virtual Machine Manager 2012 R2 installed in high availability to the Technical Preview 2. Architecture Overview My Virtual Machine Manager ...

The post Upgrade Virtual Machine Manager 2012 R2 in High Availability to Technical Preview 2 appeared first on Tech-Coffee.

]]>
Currently the last build for the next release of Virtual Machine Manager is the Technical Preview 2 (maybe Technical Preview 3 in the end of the month). In this topic, I will explain how to upgrade Virtual Machine Manager 2012 R2 installed in high availability to the Technical Preview 2.

Architecture Overview

My Virtual Machine Manager nodes are in a failover cluster connected by two networks:

  • LAN Network (client and cluster communications)
  • Cluster Network (cluster communications)

The Virtual Machine Manager database is stored in an AlwaysOn Availability Group to support the high availability.

Migrate Windows Server 2012 R2 to Technical Preview 2

Before upgrading your servers in Technical Preview 2, please be careful because there are a lot of known issues that I have experienced.

Known issues

First, in the Technical Preview 2 of Windows Server, Windows Update is not available. So you have to download the update manually to update your system. Then when you have upgraded your system to Technical Preview 2, the network adapters are disabled. To be able to enable them, you have to remove them from Device Manager and reboot your system. When you update a system where a failover clustering was installed, you have to remove also the Virtual Ethernet Failover Adapter (from hidden devices). Otherwise, the cluster will not start.

You can have a list of important known issues here.

Upgrade the first node

To upgrade the cluster node and the cluster itself, I use a new Windows Server 2016 feature called Cluster Rolling Upgrade. For more information about this feature you can read this topic.

First, I evict the cluster node that I will upgrade from the cluster. Otherwise the upgrade wizard will not let you upgrade your system.

Next I mount the Windows Server Technical Preview 2 ISO and I run the setup. I select the image with local admin tools.

The wizard tells me that some settings will be kept during the upgrade. I click on install.

When the installation is finished, verify your network adapters. If they are disabled, you have to remove all device adapters from Device Manager (also the Virtual Ethernet Failover Adapter from hidden devices). Next reboot your machine and reconfigure your network devices. Also, verify if the cluster service is started.

Next open the Failover Cluster Manager from a Windows Server Technical Preview 2 server. Select Add Node as below.

Then specify the server name that you have upgraded.

Now you should have your both nodes in running state as below.

Now I failover the role to the server upgraded in Windows Server Technical Preview 2 to verify if the role works well on this node.

Upgrade the second node

Now I’m upgrading the second node. So I evict the other node from the cluster.

Then I mount the Windows Server Technical Preview 2 ISO on the second node and I launch setup to run the upgrade. I select an upgrade with local admin tools.

On the ready to install screen, just click on install to run the upgrade.

After the upgrade you should have the same issues that on the node 1. The network adapter should be disabled. So you have to remove all device adapters from Device Manager (also the Virtual Ethernet Failover Adapter from hidden devices). Next reboot your machine and reconfigure your network devices. Also, verify if the cluster service is started.

Next open the failover cluster manager from a Windows Server Technical Preview 2 node and select Add Node. Specify the second node and click on next.

Then select yes to run the cluster validation.

Once the node is added, you can move the vmm role to the second node to verify if Virtual Machine Manager works well on the second node.

Upgrading the cluster functional level

To finish with the cluster, the cluster functional level have to be upgraded. To upgrade it, just run Update-ClusterFunctionalLevel in an elevated PowerShell prompt.

Upgrade Virtual Machine Manager 2012 R2 to Technical Preview 2

Remove Virtual Machine Manager database from Availability Group

If the VirtualManagerDB is in an alwaysOn availability group (AAG), you have to remove it from the availability group.

Install prerequisite on both nodes

The Virtual Machine Manager Technical Preview 2 needs ADK 10. You can download it here. Next run the setup and install Deployment Tools and Windows Preinstallation Environment (Windows PE).

Upgrade the first node

Before upgrading the first node, I prefer to stop the vmm role from the cluster.

Next I run the setup of Virtual Machine Manager Technical Preview 2 on the first node. Then I select Install.

The wizard detects that a previous VMM installation exists. So first I select Remove Features.

Then I select to retain the database.

Once the features are removed, I run again the VMM installation. Then I select VMM Management Server and VMM console. The wizard detect that the node is in a cluster.

Next I specify product registration information.

Then I specify the installation location.

On prerequisites screen, check warnings and errors. If all is ok, just click on next.

Next provide database information to connect to the VirtualManagerDB. Then the wizard detects “the old” VirtualManagerDB and asks to upgrade the database.

On the next screen, provide the Domain Account password.

Next you should have an upgrade compatibility report. On my side, the SCOM connector will be removed.

Once the installation is finished you should have something as below.

Now you can switch on the second node.

Upgrade the second node

On the second node, follow the procedure as the first node. On the database configuration, the wizard will not ask you to upgrade the database because it is already upgraded. Now you can start again the vmm role from the cluster.

Add database in availability group

First edit the properties of VirtualManagerDB and navigate to options. Select the full recovery model.

Next make a full backup of the database.

To finish you can add again the VirtualManagerDB to the AlwaysOn Availability Group.

Open the Virtual Machine Manager console

Now you can open the Virtual Machine Manager Technical Preview 2 console and upgrade the agents J.

The post Upgrade Virtual Machine Manager 2012 R2 in High Availability to Technical Preview 2 appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/upgrade-virtual-machine-manager-2012-r2-in-high-availability-to-technical-preview-2/feed/ 0 3770
Generate NanoServer VHDX image easily with PowerShell //www.tech-coffee.net/generate-nanoserver-vhdx-image-easily-with-powershell/ //www.tech-coffee.net/generate-nanoserver-vhdx-image-easily-with-powershell/#comments Wed, 03 Jun 2015 09:57:05 +0000 //www.tech-coffee.net/?p=3527 The last month I have presented how to generate a NanoServer VHDX image from the Windows Server 2016 Technical Preview 2 ISO. If you have read the topic, you have seen that there are a lot of steps. So I have decided to create a PowerShell script to generate NanoServer VHDX image and I want ...

The post Generate NanoServer VHDX image easily with PowerShell appeared first on Tech-Coffee.

]]>
The last month I have presented how to generate a NanoServer VHDX image from the Windows Server 2016 Technical Preview 2 ISO. If you have read the topic, you have seen that there are a lot of steps. So I have decided to create a PowerShell script to generate NanoServer VHDX image and I want to share it in this topic.

This script enables me to save lot of time and avoid me to make mistake. There are some requirements to run this script. If you have never generated a VHDX from NanoServer.wim file, I recommend you to read this post. So to run my script you need:

  • An unattend.xml file ready;
  • A SetupComplet.cmd file ready;
  • The Windows Server 2016 TC2 ISO downloaded;
  • The Convert-WindowsImage.ps1 downloaded and copied in the same folder than my script (you can download this script here)

Unattend.xml file example

Bellow you can find an example of the Unattend.xml file. I use it to create my VHDX image:

<?xml version='1.0' encoding='utf-8'?>
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
    <settings pass="offlineServicing">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <ComputerName>NanoServer04</ComputerName>
        </component>
    </settings>

    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <UserAccounts>
                <AdministratorPassword>
                    <Value>password </Value>
                    <PlainText>true</PlainText>
                </AdministratorPassword>
            </UserAccounts>
            <TimeZone>Romance Standard Time</TimeZone>
        </component>
    </settings>

    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <RegisteredOwner>Romain Serre</RegisteredOwner>
            <RegisteredOrganization>Tech-Coffee</RegisteredOrganization>
        </component>
    </settings>
</unattend>

SetupComplete.cmd file example

You need also a SetupComplete.cmd file to run some commands on first boot. I use the below script in my lab:

netsh advfirewall set all state off
netsh interface ip set address "Ethernet" static 10.10.0.203 255.255.255.0 10.10.0.1
netsh interface ipv4 add dnsserver "Ethernet" address=10.10.0.5 index=1
hostname
ipconfig

Script to generate the NanoServer VHDX image

Below you can find the script that I have written. Copy the script in New-NSVHDX.ps1 file.

#requires -version 4.0
#requires –runasadministrator
 
<#
.SYNOPSYS
    This script enables to create Nano Server VHDX image from the NanoServer.wim file
.VERSION
    0.1: Initial version
    0.2: Change in the script to work with Convert-WindowsImage.ps1 Version 10
.AUTHOR
    Romain Serre
    Blog: //www.tech-coffee.net
    Twitter: @RomSerre
.PARAMETERS
    WorkFolder: Specify the work folder where will be stored WIM, VHDX, Dism and so on
    VHDXName: Specify the VHDX file name (without .vhdx)
    ISOLiteralPath: Specify the absolute path to the Windows Server 2016 ISO
    UnattendFile: Specify the absolute path to your unattend.xml file
    SetupCompleteFile: Specify the absolute path to SetupComplete.cmd file
.EXAMPLE
   New-NSVHDX -WorkFolder C:\temp\NanoPrep `
              -VHDXName NanoServer01 `
              -ISOLiteralPath "C:\Temp\10074.0.150424-1350.fbl_impressive_SERVER_OEMRET_X64FRE_EN-US.ISO" `
              -UnattendFile "c:\temp\unattend.xml" `
              -SetupCompleteFile "c:\temp\SetupComplete.cmd"
 
#>
 
##### Parameters #####
# ----------------------------------------------------------------
 
[CmdletBinding()]
param(
    [Parameter(Mandatory=$True, HelpMessage='Specify the work folder where will be stored WIM, VHDX, Dism and so on')]
    [Alias('WorkFolder')]
    [string]$ParentFolder,
    [Parameter(Mandatory=$True, HelpMessage='Specify the VHDX file name (without .vhdx)')]
    [Alias('VHDXName')]
    [String]$OutputImageName,
    [Parameter(Mandatory=$True, HelpMessage='Specify the absolute path to the Windows Server 2016 ISO')]
    [Alias('ISOLiteralPath')]
    [String]$ISOPath,
    [Parameter(Mandatory=$True, HelpMessage='Specify the absolute path to your unattend.xml file')]
    [Alias('UnattendFile')]
    [String]$UnattendFilePath,
    [Parameter(Mandatory=$True, HelpMessage='Specify the absolute path to SetupComplete.cmd file')]
    [Alias('SetupCompleteFile')]
    [String]$SetupCompleteFilePath
    )
 
##### Variables #####
# ----------------------------------------------------------------
 
$Vnb = "0.2"
 
# Convert-WindowsImage script name
$ConvertWindowsImageScript = "Convert-WindowsImage.ps1"

# Set SubFolder name
$DismFolder                = "Dism"
$VHDXFolder                = "VHDX"
$PkgFolder                 = "Packages"
$MountFolder               = "MountDir"
$WIMFolder                 = "WIM"
 
##### NanoServer Packages list #####.
# Comment packages that you don't want to add to the final VHDX
# ----------------------------------------------------------------
 
$PackagesList = @(
                "Microsoft-NanoServer-Compute-Package.cab",
                "Microsoft-NanoServer-OEM-Drivers-Package.cab",
                "Microsoft-NanoServer-FailoverCluster-Package.cab",
                "Microsoft-NanoServer-Guest-Package.cab",
                "Microsoft-NanoServer-Storage-Package.cab"
                )
 
##### Main Code (do not modify if you don't know what you do) #####
# -----------------------------------------------------------------
 
# SubFolders in the WorkSpace
$SubFolders = @(
                "\$DismFolder",
                "\$VHDXFolder",
                "\$PkgFolder",
                "\$MountFolder",
                "\$WIMFolder"
               )
 
# Get script path
$ScriptPath = Split-Path -Parent $PSCommandPath
$($ScriptPath + "\$ConvertWindowsImageScript")
Clear
Write-Host "  ################################################################" -ForeGroundColor Green
Write-Host "  #     Welcome to the Nano Server VHDX image generator $Vnb      #" -ForeGroundColor Green
Write-Host "  #         This script has been written by Romain Serre         #" -ForeGroundColor Green
Write-Host "  #                     Twitter: @RomSerre                       #" -ForeGroundColor Green
Write-Host "  #               Blog: //www.tech-coffee.net               #" -ForeGroundColor Green
Write-Host "  ################################################################" -ForeGroundColor Green
Write-Host
Write-Host
 
# Veryfing if Convert-WindowsImage.ps1 is present
if (!(Test-Path $($ScriptPath + "\$ConvertWindowsImageScript"))){
    Write-Host "$((Get-Date -Format g)) - Can't find $ConvertWindowsImageScript. Please copy $ConvertWindowsImageScript in the same directory that this script." -ForeGroundColor Red
    Exit
}

. $($ScriptPath + "\$ConvertWindowsImageScript") 
 
# Veryfing if ISO file exists
if (!(Test-Path $ISOPath)){
    Write-Host "$((Get-Date -Format g)) - Can't find $ISOPath. Please specify a valid path to the Windows Server 2016 ISO." -ForeGroundColor Red
    Exit
}
 
# Veryfing if unattend.xml file exists
if (!(Test-Path $UnattendFilePath)){
    Write-Host "$((Get-Date -Format g)) - Can't find $UnattendFilePath. Please specify a valid path to the unattend.xml file." -ForeGroundColor Red
    Exit
}
 
# Veryfing if SetupComplete.cmd file exists
if (!(Test-Path $SetupCompleteFilePath)){
    Write-Host "$((Get-Date -Format g)) - Can't find $SetupCompleteFilePath. Please specify a valid path to SetupComplete.cmd file." -ForeGroundColor Red
    Exit
}
 
if (!(Test-Path $ParentFolder)){
    Write-Host "$((Get-Date -Format g)) - Working folder doesn't exist. Creating working folder" -ForeGroundColor Cyan
    New-Item -ItemType Directory -Path $ParentFolder > $Null
}
Else {
    Write-Host "$((Get-Date -Format g)) - Working folder already exists. Skipping creation" -ForeGroundColor Cyan
}
 
# Preparing Subfolder in workspace
Write-Host "$((Get-Date -Format g)) - Creating subfolder in workspace ..." -ForeGroundColor Cyan
Foreach ($SubFolder in $SubFolders){
 
    if (!(Test-Path $($ParentFolder + $SubFolder))){
        Write-Host "$((Get-Date -Format g)) - Creating $($ParentFolder + $SubFolder) sub folder" -ForeGroundColor Cyan
        New-Item -ItemType Directory -Path $($ParentFolder + $SubFolder) > $null
    }
    Else {
        Write-Host "$((Get-Date -Format g)) - $($ParentFolder + $SubFolder) already exists. Skipping creation." -ForeGroundColor Cyan
    }
}
 
# Preparing NanoServer VHDX name
$OutputImageName = $OutputImageName + ".vhdx"
Write-Host "$((Get-Date -Format g)) - The VHDX image will be called $OutputImageName" -ForegroundColor Cyan
 
# Copying requirements from Windows Server 2016 ISO
Write-Host "$((Get-Date -Format g)) - Mounting $ISOPath ..." -ForeGroundColor Cyan
Mount-DiskImage $ISOPath
 
$DriveLetter = (Get-DiskImage $ISOPath | Get-Volume).DriveLetter
Write-Host "$((Get-Date -Format g)) - The ISO is mounted on $($DriveLetter):\" -ForegroundColor Cyan
 
$ISONanoPath   = $DriveLetter + ":\NanoServer"
$ISOSourcePath = $DriveLetter + ":\Sources"
 
Write-Host "$((Get-Date -Format g)) - Copying NanoServer.wim to $($ParentFolder + "\$WIMFolder")" -ForeGroundColor Cyan
Copy-Item -Path $($ISONanoPath + "\NanoServer.wim") -Destination $($ParentFolder + "\$WIMFolder") -For
 
Write-Host "$((Get-Date -Format g)) - Copying Packages folder to $($ParentFolder + "\$PkgFolder")" -ForeGroundColor Cyan
Copy-Item -Path $($ISONanoPath + "\Packages\*") -Destination $($ParentFolder + "\$PkgFolder") -Recurse -Force
 
Write-Host "$((Get-Date -Format g)) - Copying api*downlevel*.dll to $($ParentFolder + "\$DismFolder")" -ForeGroundColor Cyan
Copy-Item -Path $($ISOSourcePath + "\api*downlevel*.dll") -Destination $($ParentFolder + "\$DismFolder") -Force
 
Write-Host "$((Get-Date -Format g)) - Copying *dism* to $($ParentFolder + "\$DismFolder")" -ForeGroundColor Cyan
Copy-Item -Path $($ISOSourcePath + "\*dism*") -Destination $($ParentFolder + "\$DismFolder") -Force
 
Write-Host "$((Get-Date -Format g)) - Copying *provider* to $($ParentFolder + "\$DismFolder")" -ForeGroundColor Cyan
Copy-Item -Path $($ISOSourcePath + "\*provider*") -Destination $($ParentFolder + "\$DismFolder") -Force
 
Dismount-DiskImage $ISOPath
Write-Host "$((Get-Date -Format g)) - The ISO is dismounted" -ForegroundColor Cyan
 
# Converting WIM file to VHDX
Write-Host "$((Get-Date -Format g)) - Converting NanoServer.wim into VHDX for Gen2 Virtual Machines... " -ForegroundColor Cyan


Convert-WindowsImage -SourcePath $($ParentFolder + "\$WIMFolder\NanoServer.wim") `
                     -VHD $($ParentFolder + "\$VHDXFolder\$OutputImageName") `
                     -Edition "CORESYSTEMSERVER_INSTALL" > $Null
 
Write-Host "$((Get-Date -Format g)) - Mounting $($ParentFolder + "\$VHDXFolder\$($OutputImageName)") in $($ParentFolder + "\$MountFolder")" -ForegroundColor Cyan
cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /Mount-Image /ImageFile:$($ParentFolder + "\$VHDXFolder\$($OutputImageName)") /index:1 /MountDir:$($ParentFolder + "\$MountFolder") > $null
Foreach ($Package in $PackagesList){
 
    Write-Host "$((Get-Date -Format g)) - Adding $Package to the $($ParentFolder + "\$VHDXFolder\$($OutputImageName)")" -ForegroundColor Cyan
    cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /add-Package /PackagePath:$($ParentFolder + "\$PkgFolder\$Package") /Image:$($ParentFolder + "\$MountFolder") > $null
    cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /add-Package /PackagePath:$($ParentFolder + "\$PkgFolder\en-us\$Package") /Image:$($ParentFolder + "\$MountFolder") > $null
}
 
Write-Host "$((Get-Date -Format g)) - Committing change and unmounting image" -ForegroundColor Cyan
cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /Unmount-Image /Mountdir:$($ParentFolder + "\$MountFolder") /commit > $Null
 
# Applying the unattend.xml file to the image
Write-Host "$((Get-Date -Format g)) - Mounting $($ParentFolder + "\$VHDXFolder\$($OutputImageName)") in $($ParentFolder + "\$MountFolder")" -ForegroundColor Cyan
cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /Mount-Image /ImageFile:$($ParentFolder + "\$VHDXFolder\$($OutputImageName)") /index:1 /MountDir:$($ParentFolder + "\$MountFolder") > $null
 
Write-Host "$((Get-Date -Format g)) - Applying $UnattendFilePath" -ForegroundColor Cyan
cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /image:$($ParentFolder + "\$MountFolder") /Apply-Unattend:$UnattendFilePath > $null
 
Write-Host "$((Get-Date -Format g)) - Creating $($ParentFolder + "\$MountFolder\windows\panther")" -ForegroundColor Cyan
New-Item -Type Directory -Path $($ParentFolder + "\$MountFolder\windows\panther") > $null
 
Write-Host "$((Get-Date -Format g)) - Copying $UnattendFilePath to $($ParentFolder + "\$MountFolder\windows\panther")" -ForegroundColor Cyan
Copy-Item $UnattendFilePath $($ParentFolder + "\$MountFolder\windows\panther")
 
Write-Host "$((Get-Date -Format g)) - Committing change and unmounting image" -ForegroundColor Cyan
cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /Unmount-Image /Mountdir:$($ParentFolder + "\$MountFolder") /commit > $null
 
# Copy the SetupComplete.cmd file to the image
Write-Host "$((Get-Date -Format g)) - Mounting $($ParentFolder + "\$VHDXFolder\$($OutputImageName)") in $($ParentFolder + "\$MountFolder")" -ForegroundColor Cyan
cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /Mount-Image /ImageFile:$($ParentFolder + "\$VHDXFolder\$($OutputImageName)") /index:1 /MountDir:$($ParentFolder + "\$MountFolder") > $null
 
Write-Host "$((Get-Date -Format g)) - Creating $($ParentFolder + "\$MountFolder\windows\Setup\Scripts")" -ForegroundColor Cyan
New-Item -Type Directory -Path $($ParentFolder + "\$MountFolder\windows\Setup\Scripts") > $null
 
Write-Host "$((Get-Date -Format g)) - Copying $SetupCompleteFilePath to $($ParentFolder + "\$MountFolder\windows\Setup\Scripts")" -ForegroundColor Cyan
Copy-Item $SetupCompleteFilePath $($ParentFolder + "\$MountFolder\windows\Setup\Scripts")
 
Write-Host "$((Get-Date -Format g)) - Committing change and unmounting image" -ForegroundColor Cyan
cmd.exe /c "$ParentFolder\$DismFolder\dism.exe" /Unmount-Image /Mountdir:$($ParentFolder + "\$MountFolder") /commit > $null
 
Write-Host "Your NanoServer VHDX image is ready in $($ParentFolder + "\$VHDXFolder\$($OutputImageName)")" -ForegroundColor Cyan
Write-Host
Write-Host
Write-Host "Thank you to have used this script. Please if you have got some issues, make a feedback :)" -ForegroundColor Green

Use the script to generate the image

First copy the script and Convert-WindowsImage.ps1 in the same folder.

If you want manage the packages that will be added to the image, you can edit the script and modify the $PackagesList array to remove or to add packages (around line 69).

Then open a PowerShell command in RunAs Administrator mode and run the below command. Make sure that your ExecutionPolicy is set to RemoteSigned or Unrestricted by using the cmdlet Get-ExecutionPolicy. You can set the execution policy by using Set-ExecutionPolicy cmdlet.

.\New-NSVHDX -WorkFolder C:\temp\NanoFolder `
             -VHDXName NanoServer04 `
             -ISOLiteralPath "C:\Temp\10074.0.150424-1350.fbl_impressive_SERVER_OEMRET_X64FRE_EN-US.ISO" `
             -UnattendFile "c:\temp\NanoPrep\unattend.xml" `
             -SetupCompleteFile "c:\temp\NanoPrep\SetupComplete.cmd"

Below the explanation of each parameter:

  • WorkFolder: this is the folder where Dism, VHDX, WIM and packages will be stored;
  • VHDXName: this is the name of the final VHDX file;
  • ISOLiteralPath: specify the absolute path to the Windows Server 2016 TC2 ISO;
  • UnattendFile: specify the absolute path to the unattend.xml;
  • SetupCompleteFile: Specify the absolute path to the SetupComplete.cmd.

When the script is finished you should have something like that:

Verifying if the VHDX image works

Now that the VHDX is generated, you can create a virtual machine and attach the VHDX:

Next I start the Virtual Machine and the commands added to the SetupComplete.cmd should run on first boot:

Great it’s working J. So now I’m trying to connect to the server with PowerShell:

It’s good I can connect to my NanoServer04 J.

The post Generate NanoServer VHDX image easily with PowerShell appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/generate-nanoserver-vhdx-image-easily-with-powershell/feed/ 13 3527
Prepare a VHDX image of Nano Server //www.tech-coffee.net/prepare-a-vhdx-image-of-nano-server/ //www.tech-coffee.net/prepare-a-vhdx-image-of-nano-server/#respond Fri, 08 May 2015 15:22:31 +0000 //www.tech-coffee.net/?p=3463 Microsoft has recently announced a new version of Windows Server 2016 called Nano Server. The main advantage of this Windows Server version is the small footprint. For that, Microsoft has removed the Graphical User Interface stack, 32-bit support, local logins or Remote Desktop support. Nano Server can be managed only remotely by using PowerShell, WMI ...

The post Prepare a VHDX image of Nano Server appeared first on Tech-Coffee.

]]>
Microsoft has recently announced a new version of Windows Server 2016 called Nano Server. The main advantage of this Windows Server version is the small footprint. For that, Microsoft has removed the Graphical User Interface stack, 32-bit support, local logins or Remote Desktop support. Nano Server can be managed only remotely by using PowerShell, WMI or WinRM. Nano Server has been designed for two kinds of usage:

  • Cloud infrastructure components as Hyper-V or Scale-Out File Server ;
  • Cloud apps built on runtime as Java, .Net and so on. Nano Server supports container through Hyper-V (and maybe via Docker later).

The Windows Server 2016 Technical Preview 2 has been released this week and brings the Nano Server through a WIM file. This kind of file is great to deploy by using DHCP/WDS but I wanted to build a VHDX image to deploy Virtual Machines without using PXE. This Microsoft guide describes how to build the VHDX file from the WIM included in the Windows Server Technical Preview 2 ISO.

Preparation

First, we have to prepare our environment to do the job. So download the Windows Server TC2 ISO here. While the ISO is downloading, I create some folders by using this script (don’t forget to change the $ParentFolder variable):

$ParentFolder = "c:\temp\NanoPrep"
New-Item -ItemType Directory -Path $($ParentFolder + "\Dism")
New-Item -ItemType Directory -Path $($ParentFolder + "\VHDX")
New-Item -ItemType Directory -Path $($ParentFolder + "\Packages")
New-Item -ItemType Directory -Path $($ParentFolder + "\MountDir")
New-Item -ItemType Directory -Path $($ParentFolder + "\WIM")

 

My Work Folder looks like this:

Next I have downloaded the Convert-WindowsImage.ps1 script from this URL. I’ve downloaded this script in the $ParentFolder directory. Once your Windows Server TC2 ISO is downloaded, you can mount it and run the below script. This script will copy the WIM file and the package locally. Next, all files related to Dism are copied in the Dism folder. To finish it will make a VHDX image from the WIM file.

$ParentFolder = "c:\temp\NanoPrep"
$ISOPath = "C:\Temp\10074.0.150424-1350.fbl_impressive_SERVER_OEMRET_X64FRE_EN-US.ISO"
Mount-DiskImage $ISOPath
$DriveLetter = (Get-DiskImage $ISOPath | Get-Volume).DriveLetter
$ISONanoPath = $DriveLetter + ":\NanoServer"
$ISOSourcePath = $DriveLetter + ":\Sources"
Copy-Item -Path $($ISONanoPath + "\NanoServer.wim") -Destination $($ParentFolder + "\WIM")
Copy-Item -Path $($ISONanoPath + "\Packages\*") -Destination $($ParentFolder + "\Packages") -Recurse
Copy-Item -Path $($ISOSourcePath + "\api*downlevel*.dll") -Destination $($ParentFolder + "\Dism")
Copy-Item -Path $($ISOSourcePath + "\*dism*") -Destination $($ParentFolder + "\Dism")
Copy-Item -Path $($ISOSourcePath + "\*provider*") -Destination $($ParentFolder + "\Dism")
Dismount-DiskImage $ISOPath
Set-Location $ParentFolder
Convert-WindowsImage.ps1 -SourcePath $($ParentFolder + "\WIM\NanoServer.wim") `
                         -VHD $($ParentFolder + "\VHDX\NanoServer.vhdx") `
                         -VHDFormat VHDX `
                         -Edition 1 `
                         -VHDPartitionStyle GPT
 


Add packages to the VHDX image

Previously, we have copied some packages in our work folder. Below you have the description of each package.

Role or feature Package file
Hyper-V role Microsoft-NanoServer-Compute-Package.cab
Failover Clustering Microsoft-NanoServer-FailoverCluster-Package.cab
Drivers for hosting Nano Server as a virtual machine Microsoft-NanoServer-Guest-Package.cab
Basic drivers for a variety of network adapters and storage controllers Microsoft-NanoServer-OEM-Drivers-Package.cab
File Server role and other storage components Microsoft-NanoServer-Storage-Package.cab

Now it’s time to add this package to the NanoServer.vhdx image. For that the command dism will be used. The below script mount the image, add the packages and dismount the vhdx and commit the modification.

$ParentFolder = "c:\temp\NanoPrep"
Set-Location $ParentFolder
dism\dism /Mount-Image /ImageFile:$($ParentFolder + "\VHDX\NanoServer.vhdx") /index:1 /MountDir:$($ParentFolder + "\MountDir")
dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\Microsoft-NanoServer-Compute-Package.cab") /Image:$($ParentFolder + "\MountDir")
dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\en-us\Microsoft-NanoServer-Compute-Package.cab") /Image:$($ParentFolder + "\MountDir")

dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\Microsoft-NanoServer-OEM-Drivers-Package.cab") /Image:$($ParentFolder + "\MountDir")
dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\en-us\Microsoft-NanoServer-OEM-Drivers-Package.cab") /Image:$($ParentFolder + "\MountDir")

dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\Microsoft-NanoServer-FailoverCluster-Package.cab") /Image:$($ParentFolder + "\MountDir")
dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\en-us\Microsoft-NanoServer-FailoverCluster-Package.cab") /Image:$($ParentFolder + "\MountDir")

dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\Microsoft-NanoServer-Guest-Package.cab") /Image:$($ParentFolder + "\MountDir")
dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\en-us\Microsoft-NanoServer-Guest-Package.cab") /Image:$($ParentFolder + "\MountDir")

dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\Microsoft-NanoServer-Storage-Package.cab") /Image:$($ParentFolder + "\MountDir")
dism\dism /add-Package /PackagePath:$($ParentFolder + "\packages\en-us\Microsoft-NanoServer-Storage-Package.cab") /Image:$($ParentFolder + "\MountDir")

dism\dism /Unmount-Image /Mountdir:$($ParentFolder + "\MountDir") /commit


Configure Nano Server with a response file

It is possible to use a unattend.xml file to auto configure some settings in the server as the hostname, the time zone and so on. First, I prepare the machine to join my Active Directory Domain. So I run the below script:

$ParentFolder = "c:\temp\NanoPrep"
djoin.exe /provision /domain home.net /machine NanoServer01 /savefile $($ParentFolder + "\odjblob")

When this script is finished, a new computer account is created in Active Directory. I can move the object to apply a GPO and so manage Firewall for example J

Next I open the odjblob file and I copy the content. It looks like this:

ARAIAMzMzMwwAwAAAAAAAAAAAgABAAAAAQAAAAQAAgABAAAAAQAAAAgDAAAIAAIACAMAAAEQC ADMzMzM+AIAAAAAAADwZEKYcKZCmDCeQpigHUKYCAAKAGB6QpgQABIAcKtCmBAAEgCwp0KYPSW gj2mer06GzNIgAe4zfbClQpjA/kGYcKNCmAEAAAA9JaCPaZ6vTobM0iAB7jN9MKJCmLCdQpj88QDgsJ5Cm LCrQpgAAAAACQAAAAAAAAAJAAAAaABvAG0AZQAuAG4AZQB0AAAAAAANAAAAAAAAAA0AAABOAGE AbgBvAFMAZQByAHYAZQByADAAMQAAAAAAeQAAAAAAAAB5AAAAUwBfADUALgBdACAAZwAnAEYAL QB0AFQAOgAsADcAKgAlAEYANAAnADUAJwBPADgAdgBZACYAWAAqADoAJQAuAC4APAB3AEQAaABs AF4APwBEAGEAJQBIAHMAbgB5AEcAIQBVAEUATQBxACcATgByACEAMABbADsAUgA6AD8ARAAuAF8 AVwA5ACgAOABGADIAYAAkADYAdQA+AHIAdwAoACEAdQBeAEQANABuAFAAdwBaACEATQA6AE0AVg BOAGQAUwBkACcAYQBeACAAOABfAGYAIABhADIAeQA3AEcATQA0AFgAVgBFAFwAQwBrAHoAAAAAA AUAAAAAAAAABAAAAEgATwBNAEUACQAAAAAAAAAIAAAAaABvAG0AZQAuAG4AZQB0AAkAAAAAAAA ACAAAAGgAbwBtAGUALgBuAGUAdAAEAAAAAQQAAAAAAAUVAAAAV4rrGerLNjixfdBQEwAAAAAAAAAT AAAAXABcAFYATQBBAEQAUwAwADIALgBoAG8AbQBlAC4AbgBlAHQAAAAAAAwAAAAAAAAADAAAAFw AXAAxADAALgAxADAALgAwAC4ANAAAAAkAAAAAAAAACQAAAGgAbwBtAGUALgBuAGUAdAAAAAAAC QAAAAAAAAAJAAAAaABvAG0AZQAuAG4AZQB0AAAAAAAJAAAAAAAAAAkAAABUAG8AdQBsAG8AdQB zAGUAAAAAAAkAAAAAAAAACQAAAFQAbwB1AGwAbwB1AHMAZQAAAAAAAAAAAA==

Then I prepare my unattend.xml file and I copy it in my $ParentFolder (don’t forget to copy the content of the odjblob file):

<?xml version='1.0' encoding='utf-8'?>
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
    <settings pass="offlineServicing">
        <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <OfflineIdentification>
                <Provisioning>
                    <AccountData>ARAIAMzMzMwwAwAAAAAAAAAAAgABAAAAAQAAAAQAAgABAAAAAQAAAAgDAAAIAAIACAMAAAEQCADMzMzM+AIAAAAAAADwZEKYcKZCmDCeQpigHUKYCAAKAGB6QpgQABIAcKtCmBAAEgCwp0KYPSWgj2mer06GzNIgAe4zfbClQpjA/kGYcKNCmAEAAAA9JaCPaZ6vTobM0iAB7jN9MKJCmLCdQpj88QDgsJ5CmLCrQpgAAAAACQAAAAAAAAAJAAAAaABvAG0AZQAuAG4AZQB0AAAAAAANAAAAAAAAAA0AAABOAGEAbgBvAFMAZQByAHYAZQByADAAMQAAAAAAeQAAAAAAAAB5AAAAUwBfADUALgBdACAAZwAnAEYALQB0AFQAOgAsADcAKgAlAEYANAAnADUAJwBPADgAdgBZACYAWAAqADoAJQAuAC4APAB3AEQAaABsAF4APwBEAGEAJQBIAHMAbgB5AEcAIQBVAEUATQBxACcATgByACEAMABbADsAUgA6AD8ARAAuAF8AVwA5ACgAOABGADIAYAAkADYAdQA+AHIAdwAoACEAdQBeAEQANABuAFAAdwBaACEATQA6AE0AVgBOAGQAUwBkACcAYQBeACAAOABfAGYAIABhADIAeQA3AEcATQA0AFgAVgBFAFwAQwBrAHoAAAAAAAUAAAAAAAAABAAAAEgATwBNAEUACQAAAAAAAAAIAAAAaABvAG0AZQAuAG4AZQB0AAkAAAAAAAAACAAAAGgAbwBtAGUALgBuAGUAdAAEAAAAAQQAAAAAAAUVAAAAV4rrGerLNjixfdBQEwAAAAAAAAATAAAAXABcAFYATQBBAEQAUwAwADIALgBoAG8AbQBlAC4AbgBlAHQAAAAAAAwAAAAAAAAADAAAAFwAXAAxADAALgAxADAALgAwAC4ANAAAAAkAAAAAAAAACQAAAGgAbwBtAGUALgBuAGUAdAAAAAAACQAAAAAAAAAJAAAAaABvAG0AZQAuAG4AZQB0AAAAAAAJAAAAAAAAAAkAAABUAG8AdQBsAG8AdQBzAGUAAAAAAAkAAAAAAAAACQAAAFQAbwB1AGwAbwB1AHMAZQAAAAAAAAAAAA==</AccountData>
                </Provisioning>
            </OfflineIdentification>
        </component>
    </settings>

    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <UserAccounts>
                <AdministratorPassword>
                    <Value>Password</Value>
                    <PlainText>true</PlainText>
                </AdministratorPassword>
            </UserAccounts>
            <TimeZone>Romance Standard Time</TimeZone>
        </component>
    </settings>

    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
            <RegisteredOwner>Romain Serre</RegisteredOwner>
            <RegisteredOrganization>Tech-Coffee</RegisteredOrganization>
        </component>
    </settings>
</unattend>

To finish I integrate this unattend.xml file into my NanoServer.vhdx image by using this script:

$ParentFolder = "c:\temp\NanoPrep"
Set-Location $ParentFolder
dism\dism /Mount-Image /ImageFile:$($ParentFolder + "\VHDX\NanoServer.vhdx") /index:1 /MountDir:$($ParentFolder + "\MountDir")
dism\dism /image: $($ParentFolder + "\MountDir") /Apply-Unattend:$($ParentFolder + "\unattend.xml")
New-Item -Type Directory -Path $($ParentFolder + "\MountDir\windows\panther")
copy $($ParentFolder + "\unattend.xml") $($ParentFolder + "\MountDir\windows\panther")
dism\dism /Unmount-Image /Mountdir:$($ParentFolder + "\MountDir") /commit
 

Run commands on the first boot

It is possible to run some commands on the first boot of the Nano Server. It is very simple: just past all commands that you need in a SetupComplete.cmd file and next just copy it to the C:\Windows\Setup\Scripts folder of the image. Below you can find my SetupComplete.cmd:

netsh advfirewall set all state off
netsh interface ip set address "Ethernet" static 10.10.0.200 255.255.255.0 10.10.0.1
netsh interface ipv4 add dnsserver "Ethernet" address=10.10.0.5 index=1
ipconfig

This script disables the firewall (it’s for a lab J) and set the IP configuration on an Ethernet network interface. To finish the ipconfig is run to show me the good configuration of the Ethernet interface. Next I paste this file in $ParentFolder directory. To finish I run this script:

$ParentFolder = "c:\temp\NanoPrep"
Set-Location $ParentFolder
dism\dism /Mount-Image /ImageFile:$($ParentFolder + "\VHDX\NanoServer.vhdx") /index:1 /MountDir:$($ParentFolder + "\MountDir")
New-Item -Type Directory -Path $($ParentFolder + "\MountDir\windows\Setup\Scripts")
Copy-Item $($ParentFolder + "\SetupComplete.cmd") $($ParentFolder + "\MountDir\windows\Setup\Scripts")
dism\dism /Unmount-Image /Mountdir:$($ParentFolder + "\MountDir") /commit

Add drivers to the image

If your hardware is not recognized and you need specific drivers, you can use the below script to add drivers to the NanoServer.vhdx. Just set the $MyDriversPath variable by the path where are located your drivers.

dism\dism /Mount-Image /ImageFile:$($ParentFolder + "\VHDX\NanoServer.vhdx") /index:1 /MountDir:$($ParentFolder + "\MountDir")
dism\dism /Add-Driver /image:$($ParentFolder + "\MountDir") /driver: $MyDriversPath
dism\dism /Unmount-Image /Mountdir:$($ParentFolder + "\MountDir") /commit

Deploy NanoServer Virtual Machine

So I have created a Virtual Machine in Hyper-V and I have selected the NanoServer.vhdx disk.

Once the machine is deployed, just specify enter-pssesion –ComputerName NanoServer01

As you can see above, we are connected to the NanoServer remotely. You can also connect to the server by using Windows Explorer:

And you can use MMC as Event Viewer remotely:

Now that we have access to the server remotely, we can create cluster, configure Hyper-V and so on. But don’t expect to manage the server as before. There is no console installed locally and there is no local logins supportJ.

To finish, let’s talk about the footprint. As you can see below, the footprint of the Nano Server is really small. The VHDX file size is only 988 MB!


The post Prepare a VHDX image of Nano Server appeared first on Tech-Coffee.

]]>
//www.tech-coffee.net/prepare-a-vhdx-image-of-nano-server/feed/ 0 3463