Page 1 of 1

checking local host time

Posted: Mon Feb 21, 2022 3:00 pm
by localit
my goal is to check the time of a windows machine and compare it to domain controller or ntp server.

- if the difference is greater then 2mins i would like for it to alert me.

is this possible without adding bat file or ps script to every single host that i am trying to check.

Re: checking local host time

Posted: Tue Feb 22, 2022 3:48 pm
by gsmith
Hi

If you install samba on your XI server you can run the command "net time -S xxx.xxx.xxx.xxx
to get the time on a remote Windows machine.

Code: Select all

[root@gs-cent8-23-82 libexec]# date; net time -S 192.168.23.96
Tue Feb 22 14:33:43 CST 2022
Tue Feb 22 12:33:34 2022
You can use that command as part of a custom plugin to check time vs. a time server.

Here's a Linux command to get the time from NIST:

Code: Select all

[root@gs-cent8-23-82 libexec]# cat </dev/tcp/time.nist.gov/13

59632 22-02-22 20:47:47 00 0 0 695.9 UTC(NIST) *
[root@gs-cent8-23-82 libexec]#
Thanks