Set-TimeZone
SYNOPSIS
Sets the system time zone to a specified time zone.
SYNTAX
Name (Default)
Set-TimeZone [-Name] <String> [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
Id
Set-TimeZone -Id <String> [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
InputObject
Set-TimeZone [-InputObject] <TimeZoneInfo> [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
> This cmdlet is only available on the Windows platform. The `Set-TimeZone` cmdlet sets the system time zone to a specified time zone.
EXAMPLES
Example 1: Set the time zone by Id
Set-TimeZone -Id "Russian Standard Time" -PassThru
Id : Russian Standard Time
DisplayName : (UTC+03:00) Moscow, St. Petersburg
StandardName : Russia TZ 2 Standard Time
DaylightName : Russia TZ 2 Daylight Time
BaseUtcOffset : 03:00:00
SupportsDaylightSavingTime : True
Example 2: Set the time zone by name
Set-TimeZone -Name "Russia TZ 2 Standard Time"
As we saw in the previous example, the Id and the Name of the Time Zone do not always match. The Name parameter must match the StandardName or DaylightName properties of the TimeZoneInfo object.
PARAMETERS
-Id
Specifies the ID of the time zone that this cmdlet sets. A full list of Time Zone IDs can be obtained by running the following command: `Get-TimeZone -ListAvailable`.
Type: System.String
Parameter Sets: Id
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-InputObject
Specifies a TimeZoneInfo object to use as input.
Type: System.TimeZoneInfo
Parameter Sets: InputObject
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Name
Specifies the name of the time zone that this cmdlet sets. A full list of Time Zone names can be obtained by running the following command: `Get-TimeZone -ListAvailable`.
Type: System.String
Parameter Sets: Name
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PassThru
Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
System.String, System.TimeZoneInfo, System.String
OUTPUTS
NOTES
This cmdlet is only available on Windows platforms.