VMware Horizon Community
MrBeatnik
Hot Shot
Hot Shot
Jump to solution

Command to Delete (and recreate) LinkClones each night

This is more of a sanity-check question!

Our automated link-clones are set to REFRESH ON LOGOFF.

However, we are keen to recreate the linked clones each night so that the quickprep script runs (as the script performs a few special actions we want each day).

What command would effectively delete a desktop if nobody is logged on? Once deleted, the pool would automatically create a new desktop to bring it back to the desired level, and this new desktop would run quickprep.

Is the Send-LinkedCloneRecompose command the best way to go about what I want?

$POOLID=MYPOOLNAME

$parentVMPath=Get-Pool -Pool_id $POOLID | select -expand parentVMPath

$parentVMSnapshotPath=Get-Pool -Pool_id $POOLID | select -expand parentVMSnapshotPath

Get-Pool -Pool_id $POOLID | Get-DesktopVM | Send-LinkedCloneRecompose -ParentVMPath $parentVMPath -ParentSnapshotPath $parentVMSnapshotPath -schedule ((Get-Date).AddHours(1)) -forceLogoff $false -stopOnError $true

Our desktops are accessible 24hrs and, although quieter at night, still need to set the task on logoff and ensure that X number of machines are still available at any time.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MrBeatnik
Hot Shot
Hot Shot
Jump to solution

Just to update this,

Script created with both View and VC PS plugins.

  • Create new snapshot
  • Delete old snapshot
  • Recompose to new snapshot

All working as hoped.

View solution in original post

0 Kudos
4 Replies
joshopper
Hot Shot
Hot Shot
Jump to solution

How many users are we talking about? Is there a reason not to set your machines to Delete Immediately and then provision machines on demand? The process slows down logins but your machines would consistently be quickprep'd and you wouldn't have a window where large recompose operations would be running. 

0 Kudos
MrBeatnik
Hot Shot
Hot Shot
Jump to solution

This is what we currently do, but the turnaround is too slow; we may have 100 users logging out and then another 100 logging in every hour - and this number is going to grow.

We therefore want to change to refresh to speed up the process during the day, but we really only need the script to run once a day anyway.

0 Kudos
Jubish
Enthusiast
Enthusiast
Jump to solution

Other than On-demand provisioning, Recompose is the only option that comes to my mind.

Thanks,

Jubish

0 Kudos
MrBeatnik
Hot Shot
Hot Shot
Jump to solution

Just to update this,

Script created with both View and VC PS plugins.

  • Create new snapshot
  • Delete old snapshot
  • Recompose to new snapshot

All working as hoped.

0 Kudos