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.

SolusVM Easy Quick Install

Quick Easy Install Debian/Ubuntu apt update reboot wget https://files.soluslabs.com/install.shsh install.sh Centos yum update reboot wget https://files.soluslabs.com/install.shsh install.sh If you get an error it is because you need to install: wget Try a

Wrong Side Of The IT Ecosystem

I find it ridiculous that people are blaming Apple for job creation in China as opposed to in the US. People are also debating how US might in-source some of these manufacturing

Dedicated Server or VPS Server?

What is the difference between Dedicated Server or VPS Server?In short, VPS hosting works on a virtual shared server, where you host your website alongside others; dedicated hosting, meanwhile, gives

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