I found myself in the need to carry out some checks on a horizon infrastructure that I could not access the administration console due to the now-famous problems of Adobe FLASH So I found it convenient to use the powercli, I report some scripts used. Running the scripts requires installing the necessary components which I have already discussed in a previous post of mine.
Script to show last user login to VMware Horizon in the last month
$connectionServer=Connect-HVServer -Server $hvserver -User $hvuser -Password $hvPassword -Domain $hvDomain
$Services1=$connectionServer.ExtensionData
$eventdb=Connect-HVEvent -DbPassword $eventDbPassword
$events=Get-HVEvent -HvDbServer $eventdb -TimePeriod month -SeverityFilter AUDIT_SUCCESS
$events.events | Export-Csv C:\temp\VCSMonthLogin.csv
Script to display Horizon Session
Connect-HvServer -server $hvserver -User $hvuser -Password $hvPassword -Domain $hvDomain
$query = New-Object “Vmware.Hv.QueryDefinition”
$query.queryEntityType = ‘SessionLocalSummaryView’
$qSrv = New-Object “Vmware.Hv.QueryServiceService”
$qSRv.QueryService_Query($global:DefaultHVServers[0].ExtensionData,$query) |
Select -ExpandProperty Results |
Select -ExpandProperty NamesData |
Select-Object -Property UserName,DesktopType,DesktopName,MachineOrRDSServerDNS
Script to show user and assigned Computer
Connect-HvServer -server $hvserver -User $hvuser -Password $hvPassword -Domain $hvDomain
$AllVDIInfo = get-hvmachinesummary -PoolName $PoolName
$AllVDIInfo | Format-Table -AutoSize
a special thanks :