function Set-WindowsTimeZone {
    Sets the Windows time zone.
   By Default, this function automatically determines the Windows Time Zone from
   the host's public IP address.
   Optionally, a IANATimeZone can be specified, such as 'America/New_York' to be
   converted into a Windows time zone.
    Set-WindowsTimeZone -Force
    Sets the Windows time zone based on public IP address, without prompting for
    Set-WindowsTimeZone -IANATimeZone 'America/New_York'
    Sets the Windows time zone to 'Eastern Standard Time', which is derived from
    the IANA time zone 'America/New_York', and prompts the user for confirmation.
    IANA time zone string.
    Controls whether or not the user is prompted to change the time zone.

  [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
  param (

  if ($IANATimeZone) {
    $windows_time_zone = ConvertTo-WindowsTimeZone -IANATimeZone $IANATimeZone
  else {
    $windows_time_zone = ConvertTo-WindowsTimeZone

  Write-Output "Setting Windows Time Zone to $windows_time_zone"

  if ($Force -or $PSCmdlet.ShouldProcess('Windows Time Zone', 'set')) {
    try {
      Set-TimeZone -Name $windows_time_zone
    catch {
      throw "Failed to set timezone: $_"