Functions/Get-WorkSpaceReport.ps1
$Report=@() foreach($w in Get-WKSWorkspace) { $ConnectionStatus = Get-WKSWorkspacesConnectionStatus -WorkspaceId $w.WorkspaceId $Tags = "" foreach ($t in (Get-WKSTag -WorkspaceId $w.WorkspaceId)) { $Tags = $Tags+"$($t.Key):$($t.Value)," } If ($Tags -ne "") {$Tags = $Tags.Substring(0,$tags.Length-1) } $Report += New-Object PSObject -Property @{ WorkSpaceId = $w.WorkspaceId UserName = $w.UserName LastLoginTime = $ConnectionStatus.LastKnownUserConnectionTimestamp ConnectionState = $ConnectionStatus.ConnectionState Tags = $Tags } } $Report | Export-Csv 'C:\Report.csv' -NoTypeInformation |