Sunday, May 8, 2016

Powershell: Automatically Check and Correct multiple NTP Clients

These days I have been digging in with Powershell to write utility scripts that helps admins to save time. And just recently, I finished up the script that give me serveral days of huge brainwork, messy about 400 lines of codes. The script will automatically check the multiple NTP clients(can be the server also, that use the time from NTP. For this to work, you need to enable Remote Powershell on client computers. If remote powershell is not enabled on each of the servers to be checked, you can find my post here to enable it.

What this script will do:
This scipt will,

1) check the necessary ports (5985 or 5986), if winRM is enabled for Remote Powershell.
2) Check the current NTP values.in registry with the pre-defined values in script. If not matched, you can correct instantly.
3) Select the standard TimeZone of servers by the occurrence of mostly used values.
4) If the appropriate time zone not found, your machine time zone will be used as standard time zone. And compare each server with the standard timezone. If not matched, you can prompted to correct.
5) It select the standard time by the occurrence of current time values on each server.(compare up to minutes' detail)
6) If the appripriate current time is not found, your machine time will be used as standard time. And compare each server with the standard time. If not matched, you are prompted to correct.
7) It will detect the stopped time service and prompted you to start the service.

Hope it useful to other system admins, Cheers !


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.