Skip to content

Instantly share code, notes, and snippets.

@jakubsuchybio
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save jakubsuchybio/7286e4d7154ccd92e85f to your computer and use it in GitHub Desktop.

Select an option

Save jakubsuchybio/7286e4d7154ccd92e85f to your computer and use it in GitHub Desktop.

Revisions

  1. jakubsuchybio revised this gist Mar 16, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ad_force_time_update
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    Import-Module ActiveDirectory
    $list = Get-ADComputer -filter * -SearchBase "OU=Computers,OU=CaymanPort,DC=CaymanPort,DC=com"
    $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!
    }
    }
    }
  2. jakubsuchybio created this gist Mar 16, 2015.
    12 changes: 12 additions & 0 deletions ad_force_time_update
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    Import-Module ActiveDirectory
    $list = Get-ADComputer -filter * -SearchBase "OU=Computers,OU=CaymanPort,DC=CaymanPort,DC=com"
    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!
    }
    }