These are the contents of my script:
For testing purposes I am importing Desktop names from a CSV file, hopefully the finished script will be able to be run against a specified Pool name...
Import-Csv c:\scripts\vmnames.csv -UseCulture | %{
$vm = Get-DesktopVM -Name $_.vmName
$row = "" | Select Desktop,User,IP,Status,Duration
$row.Desktop = Desktop = $vm.Name
$row.User = $vm.user_displayname
$row.IP = $vm.ipaddress
$row.Status = $vm.state
$row.Duration = $vm.duration
$row | Export-Csv c:\scripts\results.csv - NoTypeInformation -UseCulture
This creates...
"Desktop","User","IP","Status","Duration"
"Desktop-001","mycompany.com\username","192.168.0.1",,
I know I am pulling info from the wrong place, because get-remotesession gives me "Desktop Name", "User Name", "IP", "and "Status" and "Duration". I just don't know how to format what I need into a CSV file. thanks for any help.