≡ Menu

How to find the time of remote machine using PowerShell

Getting local time using powershell is very easy. You can get it with “Get-Date” cmdlet. But how do you get time of remote machine using PowerShell? You have to rely on WMI objects to get this information.

$rtime = Get-WmiObject -Class Win32_OperatingSystem -ComputerName <yourCompName>

write-host $rtime.ConvertToDateTime($rtime.LocalDateTime)

Let me know if you figureout any other easy way.

Comments on this entry are closed.

  • infopediaonlinehere March 25, 2010, 9:02 am

    this is a useful tip on powershell…keep up the good job dude..

  • Sitaram Pamarthi March 29, 2010, 5:45 pm

    Thank you 🙂

  • DJ August 8, 2014, 1:11 am

    this doesn’t give the client local time. It is converting to the system date and timefrom where it is run.

  • Guest October 23, 2019, 1:22 am

    Spelling error in your $rtime variable Win32_OperatingSytem is missing an “s” in System

  • agustin August 7, 2020, 8:17 pm

    what happen when remote desktop has denied access
    thanks in advance

    • Wintel Rocks October 10, 2020, 10:31 pm

      This works only if you are an administrator of the remote computer.