Skip to content

Commit

Permalink
Modified Type of LastSeen from String to DateTime
Browse files Browse the repository at this point in the history
Also added a check to add a null when the json data returned from the
web api is not present or empty.
  • Loading branch information
Marcuzzo committed Nov 23, 2019
1 parent da6efd5 commit 7f67887
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion PSTeamViewer/public/Get-TVDevice.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ function Get-TVDevice

Write-Verbose -Message $_

if ($null -eq $_.last_seen)
{
$LastSeen = $null
}
else
{
$LastSeen = Get-Date -Date $_.last_seen
}

Write-Verbose -Message ('Last Seen: {0}' -f $LastSeen)
[TVDevice] $TVDevice = New-Object -TypeName TVDevice -Property @{
RemoteControlID = $_.remotecontrol_id
DeviceID = $_.device_id
Expand All @@ -69,7 +79,7 @@ function Get-TVDevice
OnlineStatus = $_.online_state
AssignedTo = $_.assigned_to
SupportedFeatures = $_.supported_features
LastSeen = $_.last_seen
LastSeen = $LastSeen
PolicyID = $_.policy_id
Description = $_.description
}
Expand Down

0 comments on commit 7f67887

Please sign in to comment.