Last active
August 29, 2015 14:17
-
-
Save jakubsuchybio/7286e4d7154ccd92e85f to your computer and use it in GitHub Desktop.
Active Directory force time update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module ActiveDirectory | |
$list = Get-ADComputer -Filter * | Where { $_.DistinguishedName -like "*Computers*" } | |
foreach ($computer in $list) { | |
echo $computer.name | |
if (Test-Connection -Cn $computer.name -BufferSize 16 -Count 1 -ea 0 -quiet ) { | |
[string]$compname = $computer.name | |
w32tm /resync /nowait /computer:$compname | |
} else { | |
echo DOWN! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment