How do the perl script get date and time of another computer

J

Johnson Bruno

Hi,
I want my perl script to get date and time of another computer
which is connected by LAN.The OS is Win 2000.

I tried this , but did not work.


$file="\\\\P418\\test\\get.cmd";
@output=qw{$file};


p418 is system name. test is a shared directory and get.cmd has "Date
/t" in the first line and "time /t" in the second line.

Thanks for your help
Bruno
 
S

Synapse

Johnson Bruno said:
Hi,
I want my perl script to get date and time of another computer
which is connected by LAN.The OS is Win 2000.

I tried this , but did not work.


$file="\\\\P418\\test\\get.cmd";
@output=qw{$file};


p418 is system name. test is a shared directory and get.cmd has "Date
/t" in the first line and "time /t" in the second line.

Thanks for your help
Bruno

What platform will the script be running on? If it's a *nix, then you'll
need to samba mount the shared directory before reading; the short
"//server/foo/bar.baz" format won't work. If it's a windows machine, try
forward instaed of backslashes in the network name, or try the Win32::*
series of modules to see if there's a way to mount the share locally, then
just disconnect it when you're done.

The easiest way, if you have admin on the server, is to install the basic
network services package, which includes the time daemon. Then you can just
use a socket to connect and read the time there.

Regards,
RyMon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top