Cleaning your vCloud Director Thumbnails (current.png)

June 15, 2013

Table of Contents

Thumbnail images are used by vCloud Director to give you a preview of the screen without opening up to the remote console, the dark side is when you migrate/svMotion a machine managed by vCloud Director, it leaves a folder along with the thumbnail, this thumbnails are created and stored by vCloud Director as current.png on the datastore in the VM’s folder.so if you are in your datastores and VMsa look or sometimes get sloopy. This PowerCLI script helps solve this, it goes through a particular datastore, and deletes all abandoned current.png files and the VM folder, this process keeps your datastores neat.

$datastore = “MyDatastore”

$viserver = “MyVIServer”

# add PowerCLI snapin

Add-PSSnapin vmware.vimautomation.core -ErrorAction:SilentlyContinue

# Connect to VI Server

Connect-VIServer $viserver

# Get the datastore we want to clean up

$dsObject = Get-Datastore $datastore

# Create a new PSDrive to that datastore

New-PSDrive -Location $dsObject -name ds -PSProvider VimDatastore -root ”

# Set location to that drive

Set-Location ds:

# From here we are going to parse through

# folders first looking for vmx files,

# if there are no vmx files,

# test for current.png and then remove the thumbnail and folder.

$dsfolders = Get-ChildItem

foreach ($dsfolder in $dsfolders)

{

    if (!(test-path “$dsfolder*.vmx”))

    {

        if (test-path “$dsfoldercurrent.png”)

        {

            remove-item “$dsfoldercurrent.png”

            if ((get-childitem .$dsfolder* | measure-object).count -lt 1)

            {

                remove-item $dsfolder

            }

        }

    }

}

Home

Share on
Facebook
Twitter
LinkedIn
Pinterest
More posts

Dedicated Servers Quick Guide

What is a Dedicated Servers? Why bother using a dedicated server over a VPS or Shared Hosting?A dedicated server is a server 100% dedicated to your website/project or business needs.

Understand How DNS servers work!

Many of use wonder how DNS works, quite frankly it needs a bit of an understanding the background process of a DNS Query to have the overall idea of the

Live Help

Get 90% Discount

First 3 People gets the Bonus!
Don't Miss Out Our Big Sale

Get 0-90% On All
247Rack Services

247Rack

The Sale Is Until The End Of March