Skip to content

Instantly share code, notes, and snippets.

@jakubsuchybio
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakubsuchybio/7286e4d7154ccd92e85f to your computer and use it in GitHub Desktop.
Save jakubsuchybio/7286e4d7154ccd92e85f to your computer and use it in GitHub Desktop.
Active Directory force time update
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