Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# PowerCLI Demo: Get Horizon Desktop Pool status at Home Lab
# Auther: gowatana
# Usage:
# PowerCLI> Connect-HVServer
# PowerCLI> ./get_desktop_pool_status_count.ps1 "Desktop_Pool"
$pool_name = $args[0]
$html_file_name = "desktop_status_count_" + $pool_name + ".html"
$time_stamp = Get-Date -f "yyyy/MM/dd HH:mm:ss K"
$desktops = Get-HVMachine -PoolName $pool_name
$desktops_status = $desktops | select `
# Output Desktop Table
$desktops_status | ft -AutoSize
# Get Desktop Pool Status Summary
$desktop_status_table = $desktops_status | Group-Object BasicState |
Sort-Object Name | select `
# Output Desktop Pool Status Summary
$desktop_status_table | ft -AutoSize
# Output HTML
$desktop_status_table | ConvertTo-Html `
-Title "Pool Status Report" `
-PreContent "
<h3>Desktop status count</h3>
<p>Pool: $pool_name</p><hr>" `
-PostContent "<hr><p>Timestamp: $time_stamp</p>" |
Out-File -Encoding utf8 -FilePath $html_file_name
Write-Host "HTML Report: $html_file_name"
Copy link

gowatana commented Aug 2, 2022

Horizon 8 デスクトップ プールの状況を PowerCLI で取得してみる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment