How to replace a drive in Storage Spaces




# Find the failed Disk
# Shutdown, take the disk out and reboot. Set the missing disk to a variable
$missingDisk = Get-PhysicalDisk | WhereObject { $_.OperationalStatus -eq ‘Lost Communication’ }
# Retire the missing disk
$missingDisk | Set-PhysicalDisk Usage Retired
# Find the name of your new disk
# Set the replacement disk object to a variable
$replacementDisk = Get-PhysicalDisk –FriendlyName PhysicalDisk1
# Add replacement Disk to the Storage Pool
Add-PhysicalDisk –PhysicalDisks $replacementDisk –StoragePoolFriendlyName pool
# Repair each Volume
Repair-VirtualDisk –FriendlyName <VolumeName>
# Get the status of the rebuilds
# Remove failed Virtual Disks
Remove-VirtualDisk –FriendlyName <FriendlyName>
# Remove the failed Physical Disk from the pool
Remove-PhysicalDisk –PhysicalDisks $missingDisk –StoragePoolFriendlyName pool

How to kill a stucked VM in Hyper-V 3.0

From time to time you may have a VM which is not responsive in both the guest OS but also that it wont shutdown/restart on the hyper-v host AND it can also be in a stopped starte which really wont let you manage the vm anymore.

A running VM is just a little process on the host called vmwp.exe. There is one such process for each VM and to find the correct GUID (the unique identificatior) you will have to go into your folder where your virtual machine is located. The folder name and/or the name of the .xml file with the configuration is named with this GUID. Then you can just open task manager, locate the vmwp.exe process and the corresponding GUID; right click and end process. The virtual machines is now ok to be restarted again.



Host not responding in VMM 2012 SP1 with 2012 hyper-v hosts

I noticed this weekend that one host in a Windows 2012 Failover Cluster showed «host not responding» in the statuswindo in VMM 2012. The VMs running on the host worked just fine and we could managed the VMs through both Hyper-V manager and Failover Cluster msc.

The event viewer on the host showed error 3001 very often (every half min. or even more often).

This error has to do something with WMI so I guess this had to do with the Performance Counter not giving the info to VMM.

I came over a nice blog (please send me the link again for reference!) which showed me how to reset the performance counter

open an eleveted cmd.exe promot and go to c:windowssyswow64

There you can run the following command (you must have navigated to the c:windowssyswo64 directory or else you will get an error with error code 2 saying you can’t restore from a system restore backup)

lodctr /R

After that you must run the following command to sync the information, important!

winmgmt.exe /RESYNCPERF

How to reclaim space in .vhdx files and shrink disc

The Problem

You have a 250GB VHD Dynamic VHD file which has eaten too much of your Hyper-V host’s drive space (WSUS Instances come to mind).   You have accessed the virtual machine and deleted/removed the unwanted bloat that occurs over time.  But, you still can’t shrink the .VHD file on the host server.

The Solution

Simply deleting or otherwise removing files from your virtual machine’s drive does not allow the VHD to be shrunk.  You must “Zero Out” the unused sectors so Hyper-V can reclaim the space. Remember this wil max out the capcity of the .vhdx files so you wil need to have enough space on your host.


The How To

  1. Download Secure Delete from Microsoft onto the Virtual Machine
    Important: Remember to unzip the file to an easy to access location.
  2. Open a Command Prompt
    Important: Remember to launch as Administrator!
  3. Execute SDelete as follows (where [path] is the located you unzipped the file)
    [PATH]sdelete –c -z
  4. Accept the terms and let it run
  5. Wait….
  6. Shutdown the virtual instance
  7. Launch Hyper-V Manager on the host server
  8. Open up the setting panel for the Hyper-V instance you wish to perform a VHD shrink for.
  9. Select the drive you wish to compact and click Edit
  10. Select Compact and click Finish
  11. Wait…



how to remote control workgroup server 2012 R2 with Server Manager

I often deploy standalone hyper-v host to customers with the free 2012 R2 hyper-v. To be able to manage the servers with GUI i prefer to use Server Manager and the hyper-v console. This can be achvied with the following.

Install a Windows 2012 R2 VM wich you can use to manage server you have deployed remotely.

Install the hyper-v rsat tools with the standard role/feature wizard on the management server.

Estable a site-2-site frmo your firewall to their firewall.

Turn off (or do research on what must be open..) the firewall on the hyper-v node. Shouldn’t be too scary if it is not internet-faced.

Make sure you have connection between the server, by f.ex ping.

Add the remote servername and the ip to the c:windowssystem32driversetchosts file (remember to start notepad with escalated priviliges before saving…)

Run the following in powershell on the MANAGEMENT server in powershell. Remember to change SERVERNAME01 to your remoteserver which you want to manage.

Set-Item wsman:localhostClientTrustedHosts SERVERNAME01 -Concatenate -Force

Change drive letter through powershell – hyper-v 2012 R2


From the Server Core server, in the command prompt I type :

C:> diskpart

Next it will display


Type List Volume

DISKPART > list volume

The listing will be like below

Volume ####
Volume 0 E DVD-ROM
Volume 1 C Partition

<Look for type DVD-CD to find drive letter>

Type the following to change the drive letter, in the example below, I’m changing it to Drive Z for my DVD-ROM

DISKPART > select volume 0
DISKPART > assign letter=z

Allow ping on hyper-v 2012 R2

Too allow ping ipv4 on a hyper-v 2012 r2 server drop into powershell and type in the following:


New-NetFirewallRule –DisplayName “Allow Ping” –Direction Inbound –Action Allow –Protocol icmpv4 –Enabled True


Hyper-V vms randoming loosing connection

In a few deployments I have seen that there has been a terrible performance and also loose of network connection between server and workstation. F:ex saving a 100Kb excel file could take 15 seconds…By pinging the server I have found out that it seemed to drop every second package.

The solution for me has to disable the tcp offload for both ipv4 and ipb6 on all the servers, including the management hyper-v parent partition and the affected virtual machines.. You can find the settings under device manager and network card (properties) on the parent partition and inside the vms itself..


Skjermbilde 2014-03-23 kl. 22.13.24

Opprett en gratis blogg eller et nettsted på

opp ↑