DSCResources/ooTime/ooTime.schema.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Configuration ooTime {
    Script 'SetTime' {
        GetScript  = {
            $output = &w32tm /query /source
            @{ Result = $output.Trim(); }
        }
        TestScript = {
            $output = &w32tm /query /source
            if ($output.Trim() -eq "time.windows.com") {
                return $true
            } else {
                return $false
            }
        }
        SetScript  = {
            &w32tm /config /manualpeerlist:time.windows.com /syncfromflags:manual /reliable:yes /update
            &w32tm /resync /rediscover
            Stop-Service w32time
            Start-Service w32time
        }
    }
}