$local:PlexInfo = $(try{([xml](Get-Content /run/plex.stream.counter/sessions -Raw -ErrorAction Stop)).MediaContainer}catch{}) $PlexInfo.ChildNodes | ForEach-Object { [PSCustomObject]@{ Object = $_ Type = $_.type Library = $_.librarySectionTitle Title = $(@($_.grandparentTitle,$_.parentIndex,$_.parentTitle,$_.index,$_.title) | Where-Object {$_}) -join ' | ' User = $_.User.title Offset = [TimeSpan]::FromMilliseconds($_.viewOffset).ToString() -split '\.' | select-object -first 1 Duration = [TimeSpan]::FromMilliseconds($_.duration).ToString() -split '\.' | select-object -first 1 # UpdateTime = [TimeSpan]::FromMilliseconds($_.).ToString() } }