Skip to content

TimeZone

OffColour edited this page Aug 22, 2018 · 11 revisions

TimeZone

Parameters

Parameter Attribute DataType Description Allowed Values
TimeZone Key String The desired time zone.
IsSingleInstance Write String Specifies if the resource is a single instance Yes

Description

The resource will use the Get-TimeZone cmdlet to get the current time zone. If Get-TimeZone is not available them CIM will be used to retrieve the current time zone. To update the time zone, .NET reflection will be used to update the time zone if required. If .NET reflection is not supported on the node (in the case of Nano Server) then tzutil.exe will be used to set the time zone.

To discover all valid time zones for this property, use this PowerShell command: [System.TimeZoneInfo]::GetSystemTimeZones().Id List of time zone values here.

Examples

Example 1

This example sets the current time zone on the node to 'Tonga Standard Time'.

Configuration Example
{
    param
    (
        [Parameter()]
        [System.String[]]
        $NodeName = 'localhost'
    )

    Import-DSCResource -ModuleName ComputerManagementDsc

    Node $NodeName
    {
        xTimeZone TimeZoneExample
        {
            IsSingleInstance = 'Yes'
            TimeZone         = 'Tonga Standard Time'
        }
    }
}
Clone this wiki locally