//learn.microsoft.com/powershell/module/microsoft.powershell.management/set-timezone?view=powershell-7.2&WT.mc_id=ps-gethelp
2.0.0
Set-TimeZone
Set-TimeZoneSYNOPSIS
Sets the system time zone to a specified time zone.
SYNTAX
Name [Default]
Set-TimeZone [-Name] [-PassThru] [-WhatIf] [-Confirm] []
Id
Set-TimeZone -Id [-PassThru] [-WhatIf] [-Confirm] []
InputObject
Set-TimeZone [-InputObject] [-PassThru] [-WhatIf] [-Confirm] []
DESCRIPTION
This cmdlet is only available on the Windows platform.
The
Set-TimeZone -Id [-PassThru] [-WhatIf] [-Confirm] []
3 cmdlet sets the system time zone to a specified time zone.EXAMPLES
Example 1: Set the time zone by Id
This example sets the time zone on the local computer to UTC.
Set-TimeZone -Id "UTC"
Id : UTC
HasIanaId : True
DisplayName : [UTC] Coordinated Universal Time
StandardName : Coordinated Universal Time
DaylightName : Coordinated Universal Time
BaseUtcOffset : 00:00:00
SupportsDaylightSavingTime : False
Example 2: Set the time zone by name
This example sets the time zone on the local computer to UTC.
Set-TimeZone -Name 'Coordinated Universal Time' -PassThru
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.
[!NOTE] The time zone names can vary based on the Culture settings in Windows. This example shows the values for a system set to
4.Set-TimeZone -Id [-PassThru] [-WhatIf] [-Confirm] []
Example 3 - List all available time zones
A full list of Time Zone IDs can be obtained by running the following command:
Get-TimeZone -ListAvailable
PARAMETERS
-Id
Specifies the ID of the time zone that this cmdlet sets.
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:
Set-TimeZone -Id [-PassThru] [-WhatIf] [-Confirm] []
5.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.
Set-TimeZone -Id [-PassThru] [-WhatIf] [-Confirm] []
0-Confirm
Prompts you for confirmation before running the cmdlet.
Set-TimeZone -Id [-PassThru] [-WhatIf] [-Confirm] []
1-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Set-TimeZone -Id [-PassThru] [-WhatIf] [-Confirm] []
2CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.