Last updated by at .

  • Hyper-V 2016
    What's new in Hyper-V 2016
  • Microsoft Azure
    Microsoft Azure

Tag: Windows Server 2012

VM Network Adapter

PowerShell One-liner to list IP Addresses of Hyper-V Virtual Machines

Here a very quick PowerShell command to list all the Virtual Network Adapters, including IP Addresses of Virtual Machines running on a Hyper-V Host.

This will give you a list of all Virtual Machines running on Hyper-V Server called “HyperV01”

sysprep.exe vm mode

Windows Sysprep for Virtual Machines

For using the same system image for different virtual machines or physical computer, Microsoft created a tool called sysprep.exe. Most people should be already familiar with that tool. If not here is the description:

Sysprep prepares a Windows installation (Windows client and Windows Server) for imaging, allowing you to capture a customized installation. Sysprep removes PC-specific information from a Windows installation, “generalizing” the installation so it can be reused on different PCs. With Sysprep you can configre the PC to boot to audit mode, where you can make additional changes or updates to your image. Or, you can configure Windows to boot to the Out-of-Box Experience (OOBE).

This is great so you can sysprep a virtual machine copy the VHD or VHDX file and use it for the first boot of different VMs. In Windows Server 2012 and Windows 8, Microsoft added an addition to sysprep called the mode switch “/mode:vm”. The mode:vm switch allows you to identify the Windows as a Virtual Machine and sysprep.exe will generalize a Virtual Hard Disk (VHD or VHDX) so that you can deploy the VHD as a VHD on the same Virtual Machine (VM) or hypervisor. You must deploy the VHD on a Virtual Machine (VM) or hypervisor with the same hardware profile. For example, if you created VHD in Microsoft Hyper-V, you can only deploy your VHD to Microsoft Hyper-V VMs with a matching hardware profile, and you can only run VM mode from inside a VM.

This will boost the performance and time for the virtual machine for the first startup and installation. This also work of course with virtual machines running on other hypervisors such as VMware or Xen.

Run the following command inside the Virtual Machine (You find sysprep.exe in the  C:\Windows\System32\Sysprep folder):

Now you can copy the VHD or VHDX file from that virtual machine and use it for other VMs.


Basic Networking PowerShell cmdlets cheatsheet to replace netsh, ipconfig, nslookup and more

Around 4 years ago I wrote a blog post about how to Replace netsh with Windows PowerShell which includes basic powershell networking cmdlets. After working with Microsoft Azure, Nano Server and Containers, Powershell together with networking becomes more and more important. I created this little cheat sheet so it becomes easy for people to get started.

Basic Networking Information with PowerShell


Get the IP Configuration (ipconfig with PowerShell)

List all Network Adapters

Get a spesific network adapter by name

Get more information VLAN ID, Speed, Connection status

Get driver information

Get adapter hardware information. This can be really usefull when you need to know the PCI slot of the NIC.

Disable and Enable a Network Adapter

Rename a Network Adapter

IP Configuration using PowerShell


Get IP and DNS address information

Get IP address only

Get DNS Server Address information

Set IP Address

or if you want to change a existing IP Address

Remove IP Address

Set DNS Server

Set interface to DHCP

Ping with PowerShell

Test-NetConnection Ping

How to Ping with PowerShell

Get some more details from the Test-NetConnection

Ping multiple IP using PowerShell


PowerShell Tracert

Tracert with PowerShell

Portscan with PowerShell

PowerShell Portscan

Use PowerShell to check for open port

NSlookup in PowerShell

PowerShell NSlookup

NSlookup using PowerShell:

Route in PowerShell

PowerShell Route

How to replace Route command with PowerShell

NETSTAT in PowerShell

PowerShell Netstat

How to replace NETSTAT with PowerShell

NIC Teaming PowerShell commands

Create a new NIC Teaming (Network Adapter Team)

SMB Related PowerShell commands

SMB PowerShell SMB Client Configuration

Get SMB Client Configuration

Get SMB Connections

Get SMB Mutlichannel Connections

Get SMB open files

Get SMB Direct (RDMA) adapters

Hyper-V Networking cmdlets

Hyper-V PowerShell Get-VMNetwork Adapter

Get and set Network Adapter VMQ settings

Get VM Network Adapter

Get VM Network Adapter IP Addresses

Get VM Network Adapter Mac Addresses

I hope you enjoyed it and the post was helpful, if you think something important is missing, please add it in the comments.

Hyper-V VM Switch

Change Hyper-V VM Switch of Virtual Machines using PowerShell

This is one of the first post of a short blog series with some simple PowerShell scripts and oneliners for Hyper-V. One this is how you can connect a Virtual Network Adapter of a Hyper-V Virtual Machine to another Virtual Switch.

This is very simple, with this command you can see all the Network Adapters of the Virtual Machine and to which Switch they are connected:

With this command you can connect it to another Switch:

Now of course you can also do this for all Virtual Machines running on a Hyper-V host:


Move multipe Hyper-V Virtual Machines with Live Storage Migration via Windows PowerShell

Well I was working in on a Private Cloud Deployment where we had some temporary storage for our Hyper-V Virtual Machines and after we got the right storage ready, which was btw a Windows Server Scale-Out File Server Cluster running with Storage Spaces and DataON JBOD chassis, we had to migrate the storage of all virtual machines running on our Hyper-V hosts. Since Windows Server 2012 offers Live Storage Migration which allows us to move the Virtual Machine to a different storage location without downtime we would use that. But if you have to move around 20 virtual machines you think twice if you want to move that via the Hyper-V Manager GUI or Windows PowerShell.

Here is a pretty simple PowerShell foreach loop which moves the storage of all virtual machines running on the Hyper-V host.

CDN Consistent Device Naming

Cisco UCS supports Consistent Device Naming (CDN)

Yesterday I posted about Cisco UCS supporting RDMA (SMB Direct) with firmware version 2.2(4b)B. Walter Dey, former Cisco Distinguished Engineer at Cisco informed me not only about the RDMA feature he also showed me that Cisco UCS now supports Consistent Device Naming which was introduced with Windows Server 2012. Consistent Device Naming (CDN) allows Ethernet interfaces to be named in a consistent manner. This makes Ethernet interface names more persistent when adapter or other configuration changes are made. To use CDN in Cisco UCS you need to run firmware version 2.2(4b)B. This will help to make it a lot easier to identify network interfaces used with Windows Server 2012 R2 and Hyper-V.

Cisco UCS Hardware

Cisco UCS supports RoCE for Microsoft SMB Direct

As you may know we use SMB as the storage protocol for several Hyper-V deployments using Scale-Out File Server and Storage Spaces which adds a lot value to your Hyper-V deployments. To boost performance Microsoft is using RDMA or SMB Direct to accelerate Storage network performance.

RDMA over Converged Ethernet (RoCE) allows direct memory access over an Ethernet network. RoCE is a link layer protocol, and hence, it allows communication between any two hosts in the same Ethernet broadcast domain. RoCE delivers superior performance compared to traditional network socket implementations because of lower latency, lower CPU utilization and higher utilization of network bandwidth. Windows Server 2012 and later versions use RDMA for accelerating and improving the performance of SMB file sharing traffic and Live Migration. If you need to know more about RDMA or SMB Direct checkout my blog post: Hyper-V over SMB: SMB Direct

With Cisco UCS Manager Release 2.2(4), Cisco finally supports RoCE for SMB Direct. It sends additional configuration information to the adapter while creating or modifying an Ethernet adapter policy.

Guidelines and Limitations for SMB Direct with RoCE

  • SMB Direct with RoCE is supported only on Windows Server 2012 R2.
  • SMB Direct with RoCE is supported only with Cisco UCS VIC 1340 and 1380 adapters.
  • Cisco UCS Manager does not support more than 4 RoCE-enabled vNICs per adapter.
  • Cisco UCS Manager does not support RoCE with NVGRE, VXLAN, NetFlow, VMQ, or usNIC.
  • You can not use Windows Server NIC Teaming together with RMDA enabled adapters in Windows Server 2012 and Windows Server 2012 R2 or you will lose RDMA feature on these adapters.
  • Maximum number of queue pairs per adapter is 8192.
  • Maximum number of memory regions per adapter is 524288.
  • If you do not disable RoCE before downgrading Cisco UCS Manager from Release 2.2(4), downgrade will fail.

Checkout my post about Hyper-V over SMB: