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.