I am currently having the below code which is taking clone of a vm and mounting OS iso file to the cloned VM cd drive
```
$SourceVMName = "999_SW999OSTest"
$CloneVMName = "999_SW999OSTest_Clone"
$VMFolder = "Shared Infra (New)"
$TargetDatastore = "DISTR_HPERF_NPROD_LUN-01_DEV_3333"
$SourceVM = Get-VM -Name 999_SW999OSTest
$VMHost = Get-VMHost -VM 999_SW999OSTest
# Get the target datastore
$Datastore = Get-Datastore -Name $TargetDatastore
$DatastoreCluster = Get-DatastoreCluster -Datastore DISTR_HPERF_NPROD_LUN-01_DEV_3333
New-VM -Name $CloneVMName -VM $SourceVM -VMHost $VMHost -Location $VMFolder -Datastore $DatastoreCluster -RunAsync
while($true)
{
Start-Sleep -Seconds 300
# Step 3: Mount ISO to the clone VM
$IsoPath = "[DISTR_HPERF_NPROD_LUN-01_DEV_3333] Patches/SW_DVD9_Win_Server_STD_CORE_2019_1809.2_64Bit_English_DC_STD_MLF_X22-18452.ISO"
# Replace with the datastore path to the ISO file
$CloneVM = Get-VM -Name $CloneVMName
if ($CloneVM.PowerState -eq "PoweredOn") {
$CDDrive = Get-CDDrive -VM $CloneVM
$CDDrive | Set-CDDrive -ISOPath $IsoPath -Connected $true -Confirm:$false
}
}
```
Next I need to install the OS from the mounted iso file. I am planning to upgrade the OS from 2016 to 2022
please let me know on how to proceed with this