You are browsing the archive for 2015 December.

Useful PowerShell commands for Hyper-V management

5:48 pm in Hyper-V, PowerShell, Private Cloud by Wim Matthyssen

Hi all,

In this blog post I will list some PowerShell commands I use from time to time on customers Hyper-V hosts to get some work done a little bit easier and faster. You can just run these commands directly in PowerShell (run as administrator) or you can copy them and save them as a .PS1.

This list is a work in progress and will be expanded in the future. So be sure to bookmark this post if you find it useful.

For the moment PowerShell v4 already includes 178 Hyper-V related cmdlets. If your interested in het entire list you can go to the following link:

In my commands I use the virtual machine (VM) CON-VM-01 as an example. If you want use the command just change the name to the name of your VM. Also for IP Addresses I use the range, so if your IP range is different just change it.

Below you can find the PowerShell commands:

1) Show what PowerShell Hyper-V cmdlets are available

Get-Command –Module Hyper-V


2) List the current configuration of the Hyper-V host

Get-VMHost | Format-List *


3) Listing all VMs on a Hyper-V host



4) Listing all running VMs on a Hyper-V host

Get-VM | where {$_.state -eq 'running'} | sort Uptime | select Name,Uptime,@{N="MemoryMB";E={$_.MemoryAssigned/1MB}},Status


5) Check if a VM has the processor compatibility mode enabled. You can find more info about this mode via following link:

Get-VMProcessor -VMName * | select VMName, CompatibilityForMigrationEnabled


6) Enable Offload Data Transfer (ODX). You can find more info about ODX via following link:

Set-ItemProperty hklm:\system\currentcontrolset\control\filesystem -Name "FilterSupportedFeaturesMode" –Value 0

7) Change the default location where VMs and virtual hard disks are stored on your Hyper-V host

Set-VMHost -VirtualHardDiskPath E:\VMs -VirtualMachinePath E:\VMs

8) Retrieve information about all network adapters on the Hyper-V host

Get-NetAdapter -Name * | Format-List -Property Name, InterfaceDescription, InterfaceName


9) Write the Hyper-V host event log to a txt file (also applicable for other servers)

Get-EventLog application -Newest 1000 | where {$_.EntryType -eq "Error"} | Out-File "$env:systemdrive\eventlog.txt" -width 300
Notepad "$env:systemdrive\eventlog.txt"

10) Get the IP Adress of a certain VM

Get-VMNetworkAdapter -VMName CON-VM-01 | Select -expand IPAddresses

11) List the IP4 Adresses of all currently running VMs

Get-VM | where { $_.state -eq 'running'} | Get-VMNetworkAdapter | Select VMName,SwitchName,@{Name="IP";Expression={$_.IPAddresses | where {$_ -match "^192\."}}} | Sort VMName


12) Remove a VM with all folders and virtual hard disks

Get-VM CON-VM-01 | %{ Stop-VM -VM $_ -Force; Remove-VM -vm $_ -Force ; Remove-Item -Path $_.Path -Recurse -Force}

As a final remark I want to mention that PowerShell can’t prevent mistakes and like you all probably know they’re easy to make. So keep your eyes open when your running these commands on production Hyper-V hosts.

Till next time!

Wim Matthyssen (@wmatthyssen)

TCP Chimney Offloading on Hyper-V hosts

6:24 pm in Hyper-V, Private Cloud by Wim Matthyssen

From time to time I’m pulled into a discussion whether or not you should disable TCP Chimney offloading on Hyper-V hosts. To be completely honest, when I just started working with Virtual Server on W2K3 (R2) it was a best practice to just disable it. Like a good ITPro, I followed that recommendation and I kept on doing it when I switched to running Hyper-V on W2K8 (R2). It just became a habit when deploying a new Hyper-V host. Furthermore like you probably already know, when your running servers with W2K12 R2 (also Hyper-V hosts) it’s turned off by default anyway (like you can see in the screenshot below). So in this blog post I will show you how you can disable it should it be enabled.


Before going into the practical part, first a little bit of information about the feature in general. TCP Chimney Offload is a networking technology that allows the work associated with moving data across a network to be offloaded from the server’s CPU to the network interface (NIC). This helps improve the processing of the network tasks such as packet segmentation without the need for additional programs or any loss to manageability or security. Programs that are currently bound by network processing overhead will generally scale better when used with TCP Chimney Offload. This allows the servers operating system (OS) to perform quicker and also speed up the processing of network traffic. Be aware that Offloading TCP tasks is only effective with a physical NIC and not with virtual ones.

As an important remark, I just want to say that it is always wise to use the latest NIC drivers and firmware on your Hyper-V hosts. In this way your always ensured the NIC manufacturers latest updates are in place and most of the latest bugs are solved.

After this short intro, it is time to get started with the real stuff.

1) To show the status of the TCP-IP Chimney Offloading on a host, open PowerShell (as an Administrator) and type cmd


2) Next run following command:

netsh int tcp show global



Like you can see the TCP Chimney Offload State is enabled

3) To disable it run following command:

netsh interface tcp set global chimney=disabled



Like you can see it’s now disabled

It’s also possible to disable TCP Chimney Offload using the registry by changing following registry keys (not applicable for all server OS versions):

4) First of all, open the registry by typing regedit in the Run bar


5) Next change following registry keys:

  • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TCPIP\Parameters\DisableTaskOffload

Setting this value to 1 disables all task offloads from the TCP/IP transport. Setting this value to 0 enables all task offloads.

  • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Ipsec\EnabledOffload

Setting this value to 0 disables Internet Protocol security (IPsec) offloads from the TCP/IP transport. The offloading of TCP/IP checksum tasks and the offloading of large TCP packets for segmentation are not affected. Setting this value to 1 enables IPsec offloads.

This concludes this blog post, hope it helps!

Wim Matthyssen (@wmatthyssen)

The Service Principal Name could not be registered in AD DS for the SCVMM 2012 R2 Management Server

11:14 am in Private Cloud, SCVMM 2012 R2, SPN by Wim Matthyssen


Sometimes when installing a new System Center Virtual Machine Manager (SCVMM) 2012 R2 Management server you can receive following message at the end of the installation: “Setup completed successfully with warnings”. Like you can read in the error message, this means the installation was successful only the Service Principal Name (SPN) could not be registered in Active Directory Domain Services (AD DS) for the SCVMM Management Server. If the SPN and SCP are not registered, SCVMM consoles on other computers will not be able to connect to this SCVMM Management Server and deploying a Hyper-V host to a bare-metal computer will not work. This problem occurs when your installing your SCVMM Management Server with an account that has insufficient rights to make chances to AD.


To fix this problem run following commands as a domain administrator from a command prompt:

1) Use setspn.exe to create SPN for SCVMM server using the following command:

"C:\Windows\system32\setspn.exe  -S SCVMM/hostname.domain accoutname".

As example:

"C:\Windows\system32\setspn.exe -S SCVMM/VMM-01.contoso.local CONTOSO\mgrscvmm".

2) Add SPN values to following registry key "Software\Microsoft\Microsoft System Center Virtual Machine Manager Server\Setup\VmmServicePrincipalNames".

3) Run "C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\setup\ConfigureSCPTool.exe -install" to configure SCP.


This should fix the issue and also concludes this blog post.

Hope it helps, till next time!

Wim Matthyssen (@wmatthyssen)

Step by step: Installing a standalone SCVMM 2012 R2 Management Server

4:34 pm in Private Cloud, scvmm, SCVMM 2012 R2 by Wim Matthyssen

clip_image002Installing the System Center Virtual Machine Manager (SCVMM) 2012 R2 Management Server is pretty straightforward and is very much like installing a new Windows Server. Its main focus is to run the SCVMM service, which processes all commands and handles all communication between the SCVMM database, the SCVMM library server(s) and the Hyper-V hosts. The SCVMM server is cluster-aware, and you can deploy it as highly available (HA) if your virtualization environment is large. But in this blog post I will go to the installation process for setting up a standalone SCVMM Management server. I will also list up all prerequisites and components to get all things up and running.

But first of all, I will start with listing some things up which need  to be kept in mind when planning your deployment:

  • The topology for a SCVMM deployment will vary according to each company’s needs. Consider the following before taking off: numbers of Hyper-V hosts, number of branch sites with hosts, security, administrative groups, self-service experience, availability and recovery time for each of the components.
  • For complete SCVMM software and hardware requirements go to the following Microsoft TechNet page:
  • If you are deploying SCVMM, you should consider that the SCVMM database no longer supports SQL Express. Therefore, you must use a supported version of SQL server (full version) to run this database.
  • At least one SCVMM library server is necessary, but you should consider foreseeing more separate servers for each external site with a low bandwith link.
  • When you are naming the SCVMM Management server, the computer name cannot contain the character string “SCVMM”.
  • The SCVMM database can reside on a SQL server with other application databases. For example, in combination with the App Controller database.
  • The SCVMM database must be in the same domain as the SCVMM server or a two-way trust must be in place.
  • Be sure to join the SCVMM Management server to the domain.
  • Create all necessary accounts in advance: SCVMM service account, RunAs account for managing hosts, SCVMM Administrators security group. Add the security group to the Local Administrator group on the SCVMM Management Server.
  • You can deploy the SCVMM Console on the same server as the SCVMM Management server, or on another server or workstation that is running a supported operating system (OS).
  • The SCVMM Management Server will be installed on a W2K12 R2 virtual machine (VM) with the Windows Firewall disabled.
  • Configure SCVMM 2012 R2 Distributed Key Management (DKM) in advance. If you do not know how, read all about it in my previous blog post:
  • For the installation log on with a domain account which is a member of the SCVMM Administrators security group and insure this account has sufficient rights to access the SQL and the AD container.

SCVMM has five major components of architecture and these are setup accordingly for this standalone installation:

  • SCVMM Management Server -> will be setup as standalone server
  • SCVMM console -> will be installed on the same server as the SCVMM Management Server
  • SCVMM Self-Service portal -> is been replaced by System Center App Controller (SCAPP)
  • SCVMM database -> will be placed on a separate SQL cluster
  • SCVMM library -> tempory local, will be replaced by a share on a separate file server

After this brief intro, it’s time to setup the SCVMM Management server. We will start off with the installation of all the required Prerequisites.

1) Install Microsoft SQL Server 2008 R2 Command Line Utilities, which can be downloaded over here:

2) Scroll down the page, until you find the exact download



3) If you right-click and install, you may receive following error


4) If so download the Microsoft SLQ Server 2008 R2 Native Client (X64 Package) and run Install









5) Now install the SQL Server 2008 R2 Command Line Utilities







6) Download the Windows Assessment and Deployment Kit (Windows ADK) for Windows 8.1, you can find it via following link:


7) Run the file as Administrator


8) Leave the default installation path and click Next


9) We don’t join the Customer Experience Improvement Program (CEIP), so we select No and click Next

10) Accept the License Agreement

11) For SCVMM 2012 R2 we only need to install the Deployment Tools and the Windows Preinstallation Environment. Select those and click Next



12) To make sure things are still ticking along under the covers, you can navigate to %temp%/adk to look at the installation log file to make sure that things are still progressing behind the scenes. The installation can be quite large up to 5.1 GB, so if you are on a slow Internet connection, you may be stuck at 0% complete for up to 15 minutes or more before you see any change in the progress bar. In the log file, look for the time that you kicked off the installation and also the time of the last log entry. You should be able to see some activity, namely ‘acquiring package’. This will mean that it’s downloading the package in the background.


Windows Assessment and Deployment Kit for Windows 8.1_20140224141443.log

Check your proxy settings if download doesn’t start or doesn’t work

13) Install the Microsoft Visual C++2010 x86 Redistributable Maintenance. You can locate the executable on the SCVMMR2VMM ISO under the folder “Prerequisites”

After all prerequisites are installed it is now time to freshly install the SCVMM Management Server

14) Go to the DVD or ISO, open it and select setup.exe


15) Click Install


16) Select VMM management server (automatically VMM console is also selected)


17) After the selection of the roles, you have to provide the information about the name of the administrator installing the product, organization details and last but not least the product key. If you don’t provide the product key during installation, you can provide it later. But be aware your installation will only be valid for a 180-day trial period


18) On the next screen, read and accept the licensing agreement and press Next


19) We will not join the Customer Experience Improvement Program (CEIP). So select No, I am not willing to participate and press Next


20) Leave the Installation location to the default and press Next


21) On the prerequisites checker, if there is any prerequisite missing, SCVMM setup will inform you about that. If so, install any missing prerequisite and re-run the checker

22) In the next screen you need to specify the database configuration. Because were installing the SCVMM database on a separate SQL cluster, we need to fill in het Server name and the proper SQL Server Instance name. In addition to this, we also have to specify the correct SQL Server listening port and the user name and domain used to connect to it


23) On the next screen we need to fill in the domain account used by the VMM service and the location for the DKM


24) In the next section leave all ports to the default and press Next


25) For the Library configuration also leave everything to the default. After installation is complete you can add a separate library shared on a file server and delete this default


26) On the last screen, a summary of all the configuration-related settings provided is shown. If everything is OK, you can click Install to start the installation




27) Like you can see installation is completed and you can Close the screen. If you mark the to open the VMM console when this wizard closes this will be opened. Here you are required to provide the right credentials


This concludes this blog post, hope it helps and till next time!

Wim Matthyssen (@wmatthyssen)

Critical status for WinRM on host status (error 20506) in SCVMM 2012 R2

6:06 pm in Hyper-V, PowerShell, scvmm by Wim Matthyssen

Some time ago I was contacted by a customer who made the switch from VMware to Hyper-V for running his virtual environment. He already installed a Hyper-V cluster with 4 nodes and was now setting up the System Center Virtual Machine Manger (SCVMM) 2012 R2 management server. That installation ran without any issues, but when he tried to add his Hyper-V hosts he bumped into a critical WinRM error, namely 20506.


After reading the “Error details” and a short investigation on the Hyper-V hosts the problem was found. All Hyper-V hosts ran with the Windows Firewall enabled, but the communication ports for the SCVMM agent were not opened. To fix this I ran the following PowerShell Cmdlets to open up port 80 and 443 which fixed the problem. Keep in mind to run PowerShell as an Administrator.

New-NetFirewallRule -DisplayName "SCVMM Agent 80" -Direction Inbound -LocalPort 80 -Protocol TCP -Action Allow

New-NetFirewallRule -DisplayName "SCVMM Agent 443" -Direction Inbound -LocalPort 443 -Protocol TCP -Action Allow

Set-NetfirewallRule -DisplayName "SCVMM Agent 80" -Enabled True

Set-NetfirewallRule -DisplayName "SCVMM Agent 443" -Enabled True


This concludes this blog post. Keep tuned and I’ll be back soon.

Wim Matthyssen (@wmatthyssen)