Hyper-V: Compact Hyper-V Virtual Hard Disk

I am attempting to do some quick cleanup on a Hyper-V host used for testing.

To do this I compacted the Hyper-V Virtual Disks.

  1. Open the Hyper-V Management console
  2. Right click on VM Guest
  3. Select Settings
  4. Select the Hard Drive for the VM Guest
  5. Click the Edit button
  6. Select Compact
  7. Click Finish

*note* you want to do this on dynamically expanding disk types

Hyper-V: Paused-Critical Virtual Machine State

I was facing an issue where vm guest are paused with the following “Paused-Critical Virtual Machine State” message. Each attempt to resume the guest, end in them being  pause once again.

This happens when the host volume is running low on available disk space.


Here are some actions you can take to help with this:

Expand the volume storage: If you are using iSCSI attached storage this may be simple to do, however fixed storage introduces complications as you may need to forklift the data or possibly migrate to a larger storage volume.

Clean up the volume: Delete unused vm guests, snapshots, and templates stored on the volume

Compact Disks: Start compacting guest machine disks.


Error: Setting up PowerShell Remoting

In an attempt to connect to a remote Hyper-V host I needed to enable PowerShell Remoting.

To enable this you simple run PowerShell as Administrator and issue the following command:

The command runs and then errors with the following output:

PS C:\WINDOWS\system32> Enable-PSRemoting

WinRM has been updated to receive requests.
WinRM service type changed successfully.
WinRM service started.

Set-WSManQuickConfig : <f:WSManFault xmlns:f=”http://schemas.microsoft.com/wbem/wsman/1/wsmanfault” Code=”2150859113″ Machine=”localhost”><f:Message><f:ProviderFault
provider=”Config provider” path=”%systemroot%\system32\WsmSvc.dll”><f:WSManFault xmlns:f=”http://schemas.microsoft.com/wbem/wsman/1/wsmanfault” Code=”2150859113″
Machine=”workstation.jermsmit.com”><f:Message>WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change
the network connection type to either Domain or Private and try again. </f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:116 char:17
+ Set-WSManQuickConfig -force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

To correct this I opened another PowerShell window, also running as Administrator issue the following command to change each of the network interfaces to be private.


At this point I was able to run the Enable-PSRemoting without error

PS C:\WINDOWS\system32> Enable-PSRemoting
WinRM is already set up to receive requests on this computer.
WinRM has been updated for remote management.
Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.
WinRM firewall exception enabled.


Remote Server Administration Tools for Windows 10 | Released

Weeks of waiting and its here at last.

Q. What is it?

A. RSAT (Remote Server Administration Tools) is a Windows Server component for remote management of other computers and server operating systems running Windows.

Grab the tools here: Remote Server Administration Tools for Windows 10


Tech-Short: Delete Virtual Switch in Hyper-V

And this happened . . .

I was introducing a change the Virtual Switch Manager of my Hyper-V host, where I attempted to give guest machines bridged network access.  After making my change I had lost access to the server.  On a good note, the server picked up a new address its virtual interface that I created.  However I am unable to connect to the Hyper-V services so I am taking steps to delete the interface and review my steps.

To do this I first attempted the following things:

Issued the command: Get-VMSwitch to list the name of the network adapter interface. I then attempted to remove the interface by entering:

After being prompted and selecting Y for “Yes” I was given an error:

Remove-VMSwitch : Failed while removing virtual Ethernet switch.
The virtual switch ‘Default VLAN’ cannot be deleted because it is being used
by running virtual machines or assigned to child pools.
The operation cannot be performed while the object is in use.
At line:1 char:16
+ Get-VMSwitch | Remove-VMSwitch
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceBusy: (Microsoft.HyperV.PowerShell.VMTas
k:VMTask) [Remove-VMSwitch], VirtualizationOperationFailedException
+ FullyQualifiedErrorId : ObjectInUse,Microsoft.HyperV.PowerShell.Commands

This error was thrown because of the virtual machine(s) I have running so I needed stop it (or them).

A quick issue of the command Get-VM to return the full name of the VM running in this lab followed by a quick issue of:

One all VM guests are off I was able to reissue the command Get-VMSwitch | Remove-VMSwitch at which point the previous IP became active again. A quick restart of the Hyper-V Server host and I was once again able to connect.

Now its time to learn what I did incorrectly to cause this issue.