2.) After everything is setup, try to reset a machine using Reset-HVMachine to check setup is fully functional.
3.) Run this PS command in PowerShell ISE
function Rebuild-HVMachine {
<#
.Synopsis
Rebuilds Horizon View desktops.
.DESCRIPTION
Queries and rebuilds virtual machines (create new cloned VM with same name from same template and applies same customization specification), the machines list would be determined
based on queryable fields machineName. Use an asterisk (*) as wildcard. If the result has multiple machines all will be reset.
Please note that on an Instant Clone Pool this will do the same as a recover of the machine.
.PARAMETER MachineName
The name of the Machine(s) to query for.
This is a required value.
.PARAMETER HvServer
Reference to Horizon View Server to query the virtual machines from. If the value is not passed or null then
first element from global:DefaultHVServers would be considered in-place of hvServer
.EXAMPLE
rebuild-HVMachine -MachineName 'PowerCLIVM'
Queries VM(s) with given parameter machineName
.EXAMPLE
rebuild-HVMachine -MachineName 'PowerCLIVM*'
Queries VM(s) with given parameter machinename with wildcard character *
.NOTES
Author : Mayank Goyal
Version : 1.0
===Tested Against Environment====
Horizon View Server Version : 7.3.0
#>
<#
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = 'High'
)]
#>
param(
[Parameter(Mandatory = $true)]
[string]
$MachineName,
[Parameter(Mandatory = $false)]
$HvServer = $null
)
Begin {
$services = Get-ViewAPIService -hvServer $hvServer
if ($null -eq $services) {
Write-Error "Could not retrieve ViewApi services from connection object"
break
}
$machineList = Find-HVMachine -Param $PSBoundParameters
if (!$machineList) {
Write-Host "Rebuild-HVMachine: No Virtual Machine(s) Found with given search parameters"
break
}
}
Process {
if ($Force -or $PSCmdlet.ShouldProcess($MachineName)) {
foreach ($machine in $machinelist){
$services.machine.Machine_RebuildMachines($machine.id)
}
}
}
End {
[System.gc]::collect()
}
}
4.) Call this function in this format Rebuild-HVMachine -MachineName 'machineName'