Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Get various details for all host pools including workspace and session host details
- ## Fuglied on to 1 line so is self contained when searching in PowerShell history (ctrl r)
- ## Get workspaces so we can check each host pool has one. Set $sub = @{} for current subscription
- $sub=@{ SubscriptionId = 'b47ba59e-56bf-4813-bd56-cf43cb26a8ac' } ;$sc = Get-AzWvdScalingPlan @sub ;$ws = @{}; get-azwvdworkspace @sub |where ApplicationGroupReference|% { $ws.Add( $_.ApplicationGroupReference[0] , $_.Name ) };Get-AzWvdHostPool @sub -PipelineVariable hp |% { $esc = $sc |where { $_.HostPoolReference | Where { $_.HostPoolArmPath -ieq $hp.id -and $_.scalingPlanEnabled -eq $true }} ; $sesh = @( Get-AzWvdSessionHost @sub -HostPoolName $hp.name -ResourceGroupName $hp.ResourceGroupName -EA 0); $hp|select @{n='HostPool';e={$_.name}},FriendlyName,Description,ResourceGroupName,HostPoolType,@{n='Enabled Scaling Plans';e={($esc|select -expand name) -join ,','}},SystemDataCreatedAt,Location,@{n='Application Group';e={$_.ApplicationGroupReference -replace '^.*/'}},@{n='Workspace';e={ $ws[ ($hp.ApplicationGroupReference.GetEnumerator()|select -first 1) ] }},@{n='Session Hosts';e={$sesh.Count}},@{n='Session Hosts Status';e={($sesh|group status|sort name|% { "$($_.Name)=$($_.Count)" }) -join ', '}},@{n='Session Count';e={($sesh|measure -Property Session -Sum).Sum}}|sort HostPool,roledefinitionname }
Advertisement