What is the PowerShell command to get the list of time zones that can be set?

https://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-TimeZone

SYNOPSIS

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

Set-TimeZone -Id  [-PassThru] [-WhatIf] [-Confirm] []
4.

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] []
2

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.

What is the PowerShell command to get the current date and time on the computer?

The Get-Date cmdlet gets a DateTime object that represents the current date or a date that you specify. Get-Date can format the date and time in several . NET and UNIX formats. You can use Get-Date to generate a date or time character string, and then send the string to other cmdlets or programs.

What is set location command in PowerShell?

The Set-Location command allows you to specify your current directory location. The PassThru parameter can be used with many Set commands in PowerShell to return information about the result for cases in which there is no default output.

Which function is used to set a particular time zone?

The date_default_timezone_set() function sets the default timezone used by all date/time functions in the script.