Albert Widjaja
asked on
need some help in modifying Powershell script to get the NTP status for all domain controllers
Hi,
Can anyone here please assist me in how to get the NTP configuration setting for all domain controllers uisng Powershell below ?
because when I use the Powershell script above, it failed with no result.
Note: the Get-DomainController cmdlet is from the Exchange Server 2010 powershell.
Thanks in advance.
Can anyone here please assist me in how to get the NTP configuration setting for all domain controllers uisng Powershell below ?
$DomainControllers = Get-DomainController
Write-Verbose "Check Domain Time Configuration `r"
ForEach ($DC in $DomainControllers) {
$ADTimeCheck = w32tm /monitor /computers:$DC
$ADTimeCheck1 = $ADTimeCheck -split ("ICMP: ")
$ADTimeCheck2 = $ADTimeCheck1 -split ("NTP: ")
$ADTimeCheck3 = $ADTimeCheck2 -split ("RefID: ")
$ADTimeCheckICMP = $ADTimeCheck3[13]
$ADTimeCheckNTP = $ADTimeCheck3[15]
[array]$DomainNTPStatus += "$DC,$ADTimeCheckICMP,$ADTimeCheckNTP"
}
$DomainNTPStatus
because when I use the Powershell script above, it failed with no result.
Note: the Get-DomainController cmdlet is from the Exchange Server 2010 powershell.
Thanks in advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is the value of the variable:
$ADTimeCheck
Do I have to run it from the Domain Controller or it can be executed from my laptop using the PowerGUI script editor ?
all of the hosts from the previous result are online and ping-able.
$ADTimeCheck
{Analyzing Microsoft.ActiveDirectory.Management .ADDomainC ontroller. Name (1 of 1)..., error WSAHOST_NOT_FOUND], , , , Microsoft.ActiveDirectory. Management .ADDomainC ontroller. Name [}
Do I have to run it from the Domain Controller or it can be executed from my laptop using the PowerGUI script editor ?
all of the hosts from the previous result are online and ping-able.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Do i have to execute the command above in the domain controller or can I run it on my laptop running with PowerGUI ?
You can run it on a workstation if it has RSAT tools installed so that the ActiveDirectory module is available. Otherwise, it would have to be done from a domain controller (assuming Server 2008 R2 or newer).
ASKER
Thanks, it works.
ASKER