Space Reduction for Windows Virtual Machines


When we work with thin provisioned virtual machines we want the virtual machine to be as storage efficient as possible, especially when we make the virtual machine portable by using ovftool or exporting the machine.

When working with Windows virtual machines we also encounter storage excesses due to the the WinSxS folder, which Microsoft states that ” the component store (WinSxS folder) contains all the components that make-up Windows to allow you operate your system.” So if you need to uninstall or re-install a component of the OS you can easily do so since this directory retains all version installed or previously installed, including service packs and updates.

It is my experience that the WinSxS folder takes up way too much space. I  have observed over 10 GB reduced ova size by using the following tools and procedure.


Reduce WinSxS

The first thing I do is remove the excessive stuff in the WinSxS directory. This can be done by using a tool for Deployment Imaging Service and Management called dism.exe (DISM).

The following command is the one I prefer using to clean out all applied updates and service packs:

Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

Clean the Drive

Once the WinSxS is cleaned up I like to run the disk cleanup tool. This tool can be found by typing Disk Cleanup.

In the disk cleanup tool you will want to select as many of the items as you deem necessary.

disk cleanup

Next you will need to defrag your drives. The first pass is a straight up defrag like the following:

defrag c:

The next defrag is for the whitespace. This is to get as much contiguous free (white) space as possible for our next step.

defrag c: /X

Remove white space

For this portion of the process we will need a tool called sdelete from sysinternals tools which is a part of Microsoft.

Just execute the following to zero the white space on the disk so it is ready to be trimmed by a hypervisor tool or technique.

sdelete -z c:

Trimming the white space

Trimming the white space can be done by using the Storage vMotion in ESXi by moving the virtual machine from datastore to datastore while setting the thin disk. There are other methods to trim white space, VMware Workstation or Fusion as well as vmkfstools.

The easiest for one-offs have been the Storage vMotion as you can select the same datastore as it currently resides upon and migrate it easily, just don’t forget to trim it.


Now we can export the virtual machine as ovf or ova.

Sites Cited


Moving VMs from datastore to datastore using PowerCLI and Storage vMotion


This is the time of season for us sysadmins to perform upgrades, updates and installation of new gear. In a virtualized world we may think that this is no longer something that is difficult or time consuming. In most cases this line of thought is correct, however, there are instances where the underlying process can be very time consuming, especially if done manually with mouse and man via the GUI interface we so love.

I am talking about upgrading a data storage system that our virtual machines ride upon. When you upgrade the storage system you need to take it offline or power it off. Obviously if you do this you will either power off all virtual machines or need to migrate them to storage that is not going to be taken down. But if you migrate all or large quantities of  VMs at the same time you may run into bandwidth bottle necks causing latency problems or worse.

This document is intended to help solve this problem by executing one move at a time automatically.

Connecting to vCenter

The first thing you want to do, assuming that you have PowerCLI setup and working correctly, is to connect to the vCenter server.

Connect-VIServer -Server  -Protocol https -User  -Password

Once the connection is established you will be able to run the subsequent commands.

Identifying the machines you wish to move

Now we want to give some thought to the machines that we want to migrate and see if there are ways to limit the quantity of machines to move. Basically adding filters to limit the returned list of virtual machines that we will eventually run our move command against.

Get-datastore | Where {$ -like '*MY_DATASTORE_BACKUP*'} | Get-VM | Where {$ -like '*ORGANIZATION_01*'}

Executing the move one virtual machine at a time

Once we have the list we want to execute the move command against each of the entries, but not all at the same time. Why? Because, it will saturate the link to your datastore which increases latency and inevitably causing server response issues or even failures.

So, we don’t want to do that. We want the system to execute each move command individually in a serial fashion. Think of it as first in first out or FIFO.

$VMs = (Get-datastore | Where {$ -like '*MY_DATASTORE_BACKUP*' } | Get-VM  | Where {$_.powerstate -eq 'PoweredOn' -and $ -like '*ORGANIZATION_01*'})

Foreach ($VM in $VMs) {
Get-VM $VM | Move-VM -Datastore "MY_DATASTORE_PRIMARY"

Here, I also took the liberty to only target the VMs that were powered on at the time. In our case the ones that were powered off were decommissioned systems that we slated for deletion.

The foreach loop is what executes each move individually. The system executes and waits for the execute to get done prior to iterating to the next item in the $VMs variable list.

Hopefully this helps others who must upgrade storage systems that their VMware infrastructure rides upon.

Using Ubuntu Unity – Virtual Desktops


When I first started using Ubuntu a few years back, I remember doing so begrudgingly. It seemed that I was going backwards in productivity when having to use Unity, so I always tried to find alternatives.

Background check here: I am a middle aged IT person that has used Linux for 15+ years. But, I had mostly used Linux in a server role and used rarly used Linux as a desktop OS. When I did use Linux as a desktop I preferred to use KDE on CentOS. I then changed jobs from managing many servers that provided ISP services, to creating IT training labs used by students. Today’s students were becoming very Linux savy and their distribution of choice was Ubuntu, so I decided to use Ubuntu as the desktop.

I decided that I would use Ubuntu as my personal desktop operating system to force myself to learn how to work through all scenarios that may crop up in the lab environments.

At first I tried using Ubuntu straight out of the box. The UI was smooth and responsive, however, it consumed a lot of real estate and was very constrictive. I had been using various virtual desktop software for Windows as well as on KDE on my CentOS system and knew there was virtual desktop availability in Unity, but the question in my mind was; “can I controll it”?

The rest of this blog will walk you through what I have done in Unity and begin to demostrate why I am now a Unity junkie!

More backgroud: my primary system is a Lenovo P50 with 64 GB RAM running Ubuntu 16.04.There are the need for some tweaks to get things to work, but some things that you can tweak on Linux work out much better than stuff you cannot easily tweak in Windows (like using 2k resolution on 4k 15″ notebook screen).

What can you do with Ubuntu Unity?

Well, this is the crux of the story. I can use many virtual desktops and lay them out in a grid of my choosing. selection_101For me I like a 3×3 solution where I can have a an instance of Firefox, Chrome, Thunderbird, Konsole, VMware Workstation and an IDE each open in their own virtual desktop that I can easily move to and move apps around using keyboard shortcuts. You can accomplish some of this with with 3rd pary tools on Windows and OSx using Dexpot and Total Spaces respectfully, but the functionality is no where near what you get with Unity. Nor could I achieve a similar smoothness of operation in KDE that I can in Unity.

Okay, so moving from virtual desktop 1 (upper left) to virtual desktop 2 (upper center) requires the use of Ctrl+Alt+➡️. If you want to move an application, you place focus on the application and use Ctrl+Shift+Alt+➡️. You can also move an application to certain locations on a virtual desktop using a keyboard shortcuts. Ctrl+Super+➡️ will place your app on the right half of your screen. You also have keyboard shortcuts for each linked application, Super+(0-9), in the launcher bar.

So, why is Unity dogged by many as a user interface? My guess is that it is too dumbed down out of the box for users first experience. It required adjustments and the download, installation and configuration of the Unity Tweak Tool before I could truly see the benefits of Unity.

Personally, I cursed using it as a lab operating system for months. After becoming completely frustrated with Unity, I finally allocated the time and effort to dig through forums, man pages and help files to figure out how to better use out of this operating environment. Now I can’t go back to using other systems for this one is working all too well.

How can you set it up?

The first thing you want to do is select System Settings from the app menu in the uppper right-handselection_108 corner of the menu bar. You can also depress Alt + F10 to access the items in the menu bar using the keyboard. Just navigate using your arrow keys to the icon that looks like a gear. A more detailed introduction to using the desktop can be found here.

Once the System Settings window is open, double-click on the Appearance icon.

In the Appearance window, under the Behavior tab put a check into the Enable workspaces box.


Now you will have an icon in your launcher bar that looks like this: selection_104

This icon represents your virtual desktops. By default you have 4 virtual desktops which you can manipulate by using keyboard shortcuts or by clicking on the icon and selecting a different desktop to use.

Okay, how can I get more than 4 virtual desktops?

I am glad you asked that question. Let’s start answering that question by downloading some software to help us out. Lets open a terminal session and type the following:

sudo apt-get update

You will need to submit your password. Then type the following:

sudo apt-get install unity-tweak-tool


Depress the Super + A keys to open the Dash App lens and type unity in the search bar:


Double-click on the Workplace Settings icon. Here you can adjust the quantity and layout of the your virtual desktops as well as many more items.


Note: you can display many keyboard shortcuts available by continually depressing the Super key. Here is a screenshot of the shortcut menu for you:



Virtual Machines “Inaccessible” after Datastore Outage


If you ever had to take a NFS datastore down to perform updates on an early release of vSphere 5.1 then you may have seen  (inaccessible) following the grayed and italicized virtual machine name in the vSphere Client.

This is a know issue and is identified in VMware ESXi 5.1u1 release notes as:

Virtual machines residing on NFS datastores are inaccessible in ESXi 5.1 host after vSphere Storage Appliance (VSA) 5.1 exits maintenance mode

The hostd agent reports the status of virtual machines incorrectly to vCenter and the ESXi host after you disconnect the NFS storage as it goes over the Misc.APDTimeout value. This issue is observed on powered off virtual machines.

This issue is resolved in this release.

This issue is commonly seen when an ESXi hosts loses connectivity with an NFS datastore.


Methods for correcting the issue is as follows:

Power CLI:

#Get Inaccessible Virtual Machines
$VMs = Get-View -ViewType VirtualMachine | ?{$_.Runtime.ConnectionState -eq "invalid" -or $_.Runtime.ConnectionState -eq "inaccessible"} | select name,@{Name="GuestConnectionState";E={$_.Runtime.ConnectionState}}write-host "---------------------------"
write-host "Inaccessible VMs"
write-host "---------------------------"


#Reload VMs into inventory
Get-View -ViewType VirtualMachine | ?{$VMs} | %{$_.reload()}

#Show new state of reloaded VMs
$ReloadedVMs = Get-View -ViewType VirtualMachine | ?{$VMs} | select name,@{Name="GuestConnectionState";E={$_.Runtime.ConnectionState}}

write-host "---------------------------"
write-host "Reloaded VMs"
write-host "---------------------------"



vim-cmd vmsvc/getallvms >grep skip
Skipping invalid VM '118'
Skipping invalid VM '127'
vim-cmd vmsvc/reload [NUMBER] 

Articles Cited:

Using Power CLI:
Using vim-cmd:
VMware ESXi 5.1u1 Release Notes:

How to disable IE Enhanced Security in Windows 2008

Have you installed Windows 2008 and tried using Internet Explorer only to find that everything that you go to has to be added to an approved list?

Have you installed another browser just to get around this problem?

Well, you probably don’t need to install another browser if you don’t want to because there is a quick way to turn this security feature off.

In the taskbar you can click on the Server Manager icon as depicted below:

In the Server Manager main window under Server Summary -> Security Information you will find a link named Configure IE ESC. Click on Configure IE ESC.

The Internet Explorer Enhanced Security Configuration will appear. This window is where you can shut-off the Enhanced Security feature by clicking the Off radio button for Administrators and/or Users account and clicking OK.

Note – you will need to close and re-open Internet Explorer to see the effects of this changed setting.

VMware I Moved It / I Copied It

The Problem

In our environment we use virtual machines on a nested hypervisor for testing. When clone or move the nested hypervisor virtual machine to another machine, the internal virtual machines all had the icon next to them indicating that they could not power up and needed attention. Upon opening a remote console session to the virtual machine, I am prompted with the following:

Of course this can be rather annoying if you must manually alter the settings for these machines on a large scale.

The Resolution

Found in the VMware KB article  “I moved it” or “I copied it” selection really just specifies whether or not the virtual machines UUID is kept or recreated.

This question can be answered automatically in the virtual machines VMX file.

To always keep the UUID add the following line to your VMX file:

uuid.action = “keep”

Note there are other circumstances that can affect the popup box appearance. I will defer to the VMware KB article for additional explanations regarding specific circumstances.