Hi Team,
I would like to export a document containing the Horizon Virtual machines both (Dedicated and Floating) and their corresponding snapshots.
I tried the below command, but it will be good if i get the info for whole Horizon VDI machines, not on the base of pool.
$pool = Get-HVPool -PoolName xxxxx
This will get you the path of the gold image
$pool.AutomatedDesktopData.VirtualCenterNamesData.ParentVmPath
This will get you the path to the snapshot
$pool.AutomatedDesktopData.VirtualCenterNamesData.SnapshotPath
Thanks,
Vivek
Did you try like this?
Get-HvPool |
Select @{N='Pool';E={$_.Base.Name}},
@{N='Snapshot';E={$_.AutomatedDesktopData.VirtualCenterNamesData.SnapshotPath}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I got the Pool - Snapshot details by using the below script. But I need Machine - Snap data (Not pool wise)
$pooldata=@()
foreach ($pool in $pools){
$pooldata+=new-object PSObject -property @{"name" = $pool.base.name;
"ParentVM"= $pool.AutomatedDesktopData.VirtualCenterNamesData.ParentVmPath.substring(($pool.AutomatedDesktopData.VirtualCenterNamesData.ParentVmPath.LastIndexOf("/")+1));"Snap"= $pool.AutomatedDesktopData.VirtualCenterNamesData.SnapshotPath.substring(($pool.AutomatedDesktopData.VirtualCenterNamesData.SnapshotPath.LastIndexOf("/")+1));
}
}
$pooldata
You should be able to do that in a loop.
Get-HVPool -PipelineVariable pool |
ForEach-Object -Process {
Get-HVMachineSummary -PoolName $pool.Base.Name |
Select @{N='Machine';E={$_.base.name}},
@{N='Pool';E={$pool.Base.Name}},
@{N='User';E={$_.namesdata.username}},
@{N='Status';E={$_.Base.BasicState}},
@{N='Type';E={$_.Base.Type}},
@{N='Snapshot';E={$pool.AutomatedDesktopData.VirtualCenterNamesData.SnapshotPath}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The vCheck for Horizon has a plugin that checks if machines are on the correct snapshot, maybe you can use that as base