Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 219257

Re: Getting the path of the latest snapshot!

$
0
0

Try something like this

 

$poolId='MyPool'

 

$pool=Get-Pool-Pool_id$poolId

 

$vm=Get-VM-Name$pool.parentVmPath.Split('/')[-1]

$snap=Get-Snapshot-VM$vm|Sort-Object-PropertyCreated-Descending|Select-First1

 

if($snap.Name -notmatch$pool.parentVMSnapshotPath)

{

    $newSnap=$pool.parentVMSnapshotPath.Replace($pool.parentVMSnapshotPath.Split('/')[-1],$snap.Name)

    Get-DesktopVM-Pool_id$poolId|

    Send-LinkedCloneRecompose-schedule ((Get-Date).AddMinutes(2)) -parentVMPath"/pathforvm/vm"-parentSnapshotPath$newSnap-forceLogoff$false-stopOnError$false

}

 

 


Viewing all articles
Browse latest Browse all 219257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>