local time from a remote computer

Hello,

How would I get local time a remote computer? I know about net time

net time \MXL6270PJF

It says:

Current time at \MXL6270PJF is 11/8/2016 5:41:50 PM

Local time (GMT-07:00) at \MXL6270PJF is 11/8/2016 3:41:50 PM

The command completed successfully.

How would I get just the local time, 11/8/2016 3:41:50 PM

Invoke-Command -ComputerName computername -ScriptBlock {Get-Date}

I tried that and it says this.

[MXL6270PJF] Connecting to remote server MXL6270PJF failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult
the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: “winrm
quickconfig”. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (MXL6270PJF:String) , PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken

I think I can use this:

Get-WmiObject -Class win32_timezone -ComputerName MXL6271NSD

Bias SettingID Caption


-420 (UTC-07:00) Mountain Time (US & Canada)

I just need to get the local time where the computer is located in.

Hey Tony, That error you got means that powershell remoting may not be enabled on the computer you are trying to run the command on, if you go to that computer and run Enable-PSRemoting it makes security changes, firewall changes, and enables the WinRM service to use powershell remotely to it,

I found a way to run Enable-PSRemoting remotely by using the sysinternal tool PSEXEC and running the following command with it,

psexec \“ComputerName or IP Address” powershell.exe “enable-psremoting -force”

once PSRemoting is enabled on the computer, you can use Enter-PSSession and the Invoke-Command commandlets

Thank you