VMware Horizon Community
sshamilt
Enthusiast
Enthusiast

View Manager Scripting

I'm looking at the ability to script View Manager to delete all linked clones in a desktop pool at a certain time at night, then rebuild the pool from a new snapshot.

We don't use delete after first use so we need a way to do this automagically.

Thanks in advance.

0 Kudos
6 Replies
JohnVUB
Contributor
Contributor

sounds like a very interesting concept, i could use it myself...

0 Kudos
Lee_Collison
Enthusiast
Enthusiast

Why not just re-compose the desktops? If you are not deleteing them after a certain amount of time I would use a Non-Persistent Pool with Persistent Desktops, this way it allows you to make changes to your master image and them assign the changes when the users log off the desktop.

If that is not an option the only other thing to do is create a PowerShell Script, but you are playing with fire when dealing with Linked Clones, these are not NORMAL virtual machines.

When we configure View for customers that want to have a clean image we deploy non-persistent desktops that delete after the first log-off, if they do not want to do this we deploy Non-Persistent. Non-Persistent actually allow for easier management because you can re-compose, re-fresh and use the User Data Disk (UDD). When using this type of desktop you can configure it to refresh automaticlly every day or every 14 days (how ever you like). As you can see this is a nice way to manage your virtual desktops.

Hope this helps.

-


Lee Collison

VCP - Enterprise Desktop

------ Lee Collison VCP - Enterprise Desktop
admin
Immortal
Immortal

There is no way to script the View manager / Composer at this time. If you need more information on the future you should try to get the presentation: DV2801 from VMworld US 2009.

Regards,

Christoph

Don't forget to award the points if this answer was helpful for you.

Blog:

http://communities.vmware.com/blogs/dommermuth |

willrodbard
VMware Employee
VMware Employee

Lee,

Sorry, juts trying to clear this up a bit.

In your post you siad "When we configure View for customers that want to have a clean image we deploy non-persistent desktops that delete after the first log-off, if they do not want to do this we deploy Non-Persistent. Non-Persistent actually allow for easier management because you can re-compose, re-fresh and use the User Data Disk (UDD). "

Do you mean if the end user does not want NON-Persistent desktops then you deploy "Persistent" desktop pools?

I'm not being picky, rather looking for a similar answer to the original post

cheers

Will

0 Kudos
ChrisKubiak
Enthusiast
Enthusiast

Wow, resurrecting an old post. Just in case the poster in question does not see your request, he must have meant Persistent as you cannot (to my knowledge) have a UDD on a Non-Persistent pool. The Persistent pools have an option called "Refresh OS Disk on Logoff" and one of the options you can select is "Every" that opens a new field to select "X" of days.

As for the original post you can "refresh" them automatically but I believe the original poster was looking to script a Recompose operation, the difference being whether or not you change the parent image the linked clone is based off of that I do not believe is currently an option. There have been rumblings that View will eventually get PowerShell integration at which point it may be possible.

0 Kudos
sshamilt
Enthusiast
Enthusiast

I feel rather bad for not keeping up to date with my VMware communities. Sorry!

The pools I was refering to were non-persistant pools. We have two pools for our students; a library one and one for mobile computing.

Essentially, these sit on rather expensive (and small) SSDs, so to ensure that the VMs don't grow so large that they fill the datastores up I had to come up with a way of refreshing them overnight (when no students are in class).

I have a scheduled task on one of my View connection servers that runs a powershell script, here is a snippet of the code I use:

Write-host "--"
Write-host "Refreshing Pools"
Write-host "--"

$pools = "pool1","pool2"

$datetime = get-date -format "MMMM d yyyy"
$datetime = $datetime + " 22:00"

$logdate = get-date -format yyyy\-MM\-dd

$logfilepath ="C:\Powershell_Logs\"
$logfile =$logfilepath + $logdate + ".txt"
#$logfile

dir $logfilepath |? {$_.CreationTime -lt (get-date).AddDays(-14)} | del | Out-File $logfile -append

foreach ($pool in $pools) {
  $timestamp = (get-date).tostring("yyyy-MM-dd HH:mm:ss")
  Write-Output "$timestamp Refreshing pool: $pool" | Out-File $logfile -append
  Get-DesktopVM -pool_id $pool | Send-LinkedCloneRefresh -schedule $datetime -forceLogoff $true -stopOnError $true | Out-File $logfile -append

}

$timestamp = (get-date).tostring("yyyy-MM-dd HH:mm:ss")
Write-Output "$timestamp VM's awaiting refresh" | Out-File $logfile -append
Get-DesktopVM -composerTask refresh | select Name | Out-File $logfile -append
Write-Output "" | Out-File $logfile -append

This script gets a list of all VMs in a the pools specified, it then sets them to refresh at 10pm at night. It also logs this activity to a log file.

I do hope this goes some way to making up for my lack of posting.

0 Kudos