Unidesk 2.x Layer Compression Utility
17 replies, 584 views
Posted on October 20, 2016
Edited by Unidesk employee Rob Zylowski on December 28, 2016
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

After upgrading my Windows 10 OS layer from 1511 to 1607 I noticed the size of my OS Layer became 38GB.  I decided to finally figure out how to compress layers by zero out deleted blocks in the VM then using vmkfstools to punch the blocks out of the vmdk.  The resulting layer was only 15 GB.

I then wrote a blog (to be released soon) describing how to do it.

My boss then challenged mne to develop automation around the process so I created this utility whcih allows you to compress every layer you arte about to finalize.  Most layers only shrink a little in soze maybe a third of the layer but it does allow you to keep layers as small as possible.

This is the first version of this utility.  I have tested it but no one else has.  Please test any layers you create prior to rolling them out to real users.

Here is the documentation

 

Here is the utility

Update Ver 1.1 10-31-2016

Shane found a bug in the MA test scripting.

Update ver 1.2 11-2-2016

Another small bug fix plus i added to the documentation that you must enable ssh on the host and allow ssh through the firewall.

Update ver 1.3 11-6-2016

Thanks to help from several csutomers I fixed a bug when using edit latest version which would show some strane results when you retirieved the running install machines.  I also changed how i look for the attached disk on teh console machine to check the disk label to make sure it matches the disk we attached.  Lastly i leave open the powershell window in case you want to review any errors.  But rmember errors woud eb listed in the log file as well.

Update 1.31 11-8-2016

I small change i thought i had made already.  If you have set this up you just need to update the compress.ps1 file.

Update 2.0 12-9-2016

Some user had issues wiht the way to utility determined which disk on the console machine to process.  I reworked the logic for that so it would work universally.

Update 2.1 12-16-2016

My last update was not sufficient to fix the issue where the filenames didnt match from our database to the layer.  This version now chooses the last disk attached to the Install Machine as the disk to modify.  This seems to always work.

Update 12-28-2016

I added the ability to compress UEP disks for persistent desktops.  Please read the documentaiotn carefully and test first on desktops of non-real users.  I have tested wiht OK resutls.  I saved about 1-2 GB per desktop for UEP disks.

As always after you download the zip edit the properties and unblock the zip before extracting it.

Let me know how it works for you if you try it.

Rob

 

Posted on October 28, 2016
Edited by connerrs on October 28, 2016
connerrs
Registered user
Joined: February 4, 2016

Hey Rob,

I'm trying to test this out but keep getting an error when saving the MA administrator account/password. The same username and password work on the console itself and the other utilities, like the Backup utility, so I don't believe it's an issue with the credentials. Any tips?

When I click "Save MA Info" I get the following:

Saving MA Account and Password information
Encrypting and Saving the MA root password
Encrypting and Saving the MA Administrator password
Initializing the MA for use with plink
The MA was successfully initilized for use with plink
Testing the MA Root Password
The MA Root Password successfully passed the logon test
Testing the Administrator Account
The MA administrator account/password logon test failed
Please enter the administrator account/password again and retry the save
Changes were not all saved
Posted on October 28, 2016
Edited by Unidesk employee Rob Zylowski on October 28, 2016
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

Hi Conner,

When you donwloaded the zip did you unblock it before extracting the contents.  It could be that all the scripts are blocked.  To see go into the powershell folder and look at the properties of the scripts.  See if they are blocked and if they are unblock them.  It not let me know and i will review the code.

Rob

Posted on October 31, 2016
connerrs
Registered user
Joined: February 4, 2016

Hi Rob,

I've confirmed that the files are unblocked. Please let me know if there's anything else I can/should try on my end. Thanks

Posted on November 3, 2016
Jeremy Ey
Registered user
Joined: May 22, 2012

Rob,

Is there a way to have the console window that opens during the Compress operation stay open? I'm getting an error there, but haven't been able to capture it.

The log correctly lists my install machine, the utility VM, but for the disk logs: "Disk to process wll be []" it then ends with "Unable to attach VMDK to console machine - ExitingScript"

Thanks,

Jeremy Ey

Posted on November 3, 2016
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

Hi Jeremy,

After you try to run it it should save all the settingings in a config file called layerinfo.txt.  If that is there you can edit the compress.ps1 file "As Administrator" then run that in the powershell IDE and see what happens.

Lety me know if you need me to jump on a zoom wiht you to troubleshoot.

Rob

Posted on December 11, 2016
Edited by geriksen on December 11, 2016
geriksen
Registered user
Joined: January 4, 2011

Hi Rob,

Seems like the Storage Module are missing in Windows 7 32bit. I tried to get your tool working from a Unidesk VM, but without any luck. Also installed Powershell v5, but still no Storage Module here. Seems like this is only supported for Windows 2012... So can this be fixed to support Windows 7?

Posted on December 16, 2016
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

Sorry Glenn I am just seeing this.

I have not tested on Win 7 but the storage cmdlets come from VMware's PowerCLI.  Did you install PowerCli ? 

You need at least version 5.5 update 2 and Not 6.5 as I have not made it work wiht 6.5 yet and they changes deom a snapin to a module.

Rob

Posted on December 28, 2016
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

For the latest version I included support for PowerCLI 6.5

Posted on January 20, 2017
Mark Worthington
Registered user
Joined: November 10, 2014

We are working on this.  Cause our base images are way to large and we have invested a lot in building the OS layers and Application layers.  So we really don't want to start all over.  When we went through the setup process and ran it, the VM just immediately shut down.  Is this supposed to happen?

Posted on January 24, 2017
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

Hi Mark which VM was shut down do you mean the one you were running the utility from or the Install Machine.  It does shut down the install machine because we need to take its layer disk away to process it.  Then it starts it up at the end of the process and finalizes it.

Posted on March 13, 2017
Bill Ford
Registered user
Joined: April 18, 2016

Hello Rob, I am trying to utilizie the compression utility and am experiencing a few issues.  When I attempt to Compress_UEPs I get the following error message:

Running Compress
Adding snapin VMware.VimAutomation.Core
 
Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayD
                                                                       eprecati
                                                                       onWarnin
                                                                       gs
-----    -----------     ------------------- ------------------------  --------
Session  UseSystemProxy  Single              Unset                     False
User
AllUsers                 Single
RemoveSnaps.txt file found.  Snapshots will be removed.
Utility found to be running on machine [VDIVCENTER01]
Getting this machine to add our vmdk
Get-VM : 3/13/2017 9:17:17 AM    Get-VM        VM with name 'VDIVCENTER01' was
not found using the specified filter(s).
At C:\Compress30\PowerShell\CompressUEPs.ps1:285 char:16
+ $MyConsoleVM = Get-VM -Name $MyConsoleVMName
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-VM], VimException
    + FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimA
   utomation.ViCore.Cmdlets.Commands.GetVM
 
 
Unable to retrieve the console machine as a VM in vCenter - Exiting Script
 
 
Press any key to continue . . .
 
Also, when clicking on Compress_Layers I am unable to get any layers to appear.  Thoughts?
 
Thanks for your time.
Posted on March 13, 2017
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

Bill the utility need to run on a virtual machine in your vcenter so we can mount the disks on the machine running the utility.  It looks like you are running it on your vcenter.  Even if vCenter is a virtual machine its not one that is in your vCenter so when we go to look it up we wont find it.

Rob

Posted on March 22, 2017
Bill Ford
Registered user
Joined: April 18, 2016

I have the utility running on a vm in the same vcenter as unidesk.  still getting the same error message.  any ideas?

Posted on March 22, 2017
Gunther Anderson
Unidesk employee
Joined: May 17, 2010

Is the error still literally "VM with name 'VDIVCENTER01' was not found using the specified filter(s)"?  It's important to note the VM name we're picking up, and that the error is still effectively "VM not found by name."  Do you actually have a VM with the specific name reported in the error message?  If it still thinks you're VDIVCENTER01, that's weird.  That would suggest you copied the configuration from the VDIVCENTER01 machine and it somehow hasn't refreshed its information about the Windows name.  I suspect we're assuming here that the Windows machine name is the same as the VM name, and we could get confused if it's not.

Posted on March 22, 2017
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

Bill can you post the log file.

What version of vSphere are you using?

Posted on March 23, 2017
Bill Ford
Registered user
Joined: April 18, 2016

I have downloaded a fresh copy of the Compress Tool and still get an error.  we are running vsphere 5.5.0. 

I am getting the same error as before just replaced with the machine name i am running the tool on.

Thoughts?

 
Posted on March 23, 2017
Rob Zylowski
Unidesk employee
Joined: June 21, 2010

Hi Bill ill send you an email.  I think we need to get on a G2M together to troubleshoot.

Login to post comments