We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,394 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Obtain current date and time from remote computer

Is there a way to get current date and time from remote windows machine on linux?
On remote windows machine ssh not enabled, there are no powershell.
Can we achieve result via telnet or smbclient?

2
Contributors
5
Replies
2 Months
Discussion Span
1 Year Ago
Last Updated
6
Views
Question
Answered
_neo_
Junior Poster in Training
65 posts since Aug 2010
Reputation Points: 26
Solved Threads: 3
Skill Endorsements: 0

How abt rsh? Is that enabled? ssh is just a secure-rsh, so whatever you can do with ssh can also be done with rsh.

thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
Skill Endorsements: 0

Thank you for reply.
Can you give some example codes, please.

_neo_
Junior Poster in Training
65 posts since Aug 2010
Reputation Points: 26
Solved Threads: 3
Skill Endorsements: 0

Sorry my bad. I did not read "from remote windows machine on linux?"
Well, I've never done this. In fact I've never even connected from a windows to windows from command line.
I assume telnet works?
have you tried:

telnet <machine> <<EO_MY_INPUT >> output_of_telnet_session.txt
<password>
date /t (or whichever is the command to get date/time)
exit
EO_MY_INPUT

You should have the output in output_of_telnet_session.txt, which you can parse using std linux stuff, grep, sed, awk,...
If you have password-less authentication setup, skip the password on line 2.

thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
Skill Endorsements: 0

Thank you for response, friend. I'll try!

_neo_
Junior Poster in Training
65 posts since Aug 2010
Reputation Points: 26
Solved Threads: 3
Skill Endorsements: 0

Ale answered me on StackOverflow.com
Thanks him.

This is his answer:
You can use the net time command (net is part of SAMBA):
net time -S computername
(the same way you would use net time \computername from Windows)

_neo_
Junior Poster in Training
65 posts since Aug 2010
Reputation Points: 26
Solved Threads: 3
Skill Endorsements: 0
Question Answered as of 1 Year Ago by thekashyap

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0707 seconds using 2.66MB