November 3rd, 2012

PowerTip: Display the Current Time and Date on a Remote Computer

Doctor Scripto
Scripter

Summary: See how to use Windows PowerShell to display the current date and time on a remote computer.

Hey, Scripting Guy! Question How can I display the current date and time on a remote computer by using Windows PowerShell?

               Hey, Scripting Guy! Answer Use Windows PowerShell remoting, and the Invoke-Command cmdlet to run Get-Date.

                                     invoke-command -ComputerName dc1 -ScriptBlock {get-date}

                             A shorter version of this command is shown here:

                                     icm dc1 {get-date}

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Manu Kumar K.M

    Hi Dr Scripto,

    The above command (icm dc1 {get-date})will display the time in the local time zone, how can we display the time in the remote server’s timezone. ?