I use PoshWSUS 2.3.1.6
When I go to "Update Services" in Windows 10 and connect to my WSUS Server, I see many workstations in the server with different LastStatusReport
and LastContact
dates as shown with two examples below. Please note that my local, WSUS server and all the workstations are configured to the same Time Zone: Eastern Standard Time (UTC-05:00)
My aim is to get those dates via PowerShell and export to CSV. The code I use for this:
& Get-PoshWSUSClient | select @{name="Computer";expression={$_.FullDomainName}},@{name="Last Status Report";expression={$_.LastReportedStatusTime}}, @{name="Last Contact";expression={$_.LastSyncTime}} | export-csv -NoTypeInformation -append $FileOutput
This returns non-consistent as the time values returned are 4 hours ahead. The workstations from the picture are exported like:
590 10/16/2019 01:40 10/16/2019 04:40
413 9/26/1019 05:38 10/16/2019 05:56
So, what should be the reason it happening? Is it possible to add Time Zone info to the time value? Is it possible to cast the value to datetime by using Time Zone info? I've tried below, still same result.
Get-pswsusclient | select @{name="Computer";expression={$_.FullDomainName}},@{name="LastReportedStatusTime";expression={[datetime]$_.LastReportedStatusTime}}, @{name="LastSyncTime";expression={[datetime]$_.LastSyncTime}}
Any help would be appreciated.