Skip to content

-ListAvailable:$false not respected in Get-TimeZone #26462

Closed

Description

@yotsuda

Prerequisites

Steps to reproduce

This is a sub-issue of #25242.

The cmdlet Get-TimeZone does not respect explicit $false values for the -ListAvailable switch parameter.

PS> $result = Get-TimeZone -ListAvailable:$false
PS> $result.Count
PS> $result.Id

Expected behavior

PS> $result = Get-TimeZone -ListAvailable:$false
PS> $result.Count
1
PS> $result.Id
Tokyo Standard Time

-ListAvailable:$false should behave the same as omitting the -ListAvailable switch, returning only the current time zone.

Actual behavior

PS> $result = Get-TimeZone -ListAvailable:$false
PS> $result.Count
142
PS> $result.Id
Dateline Standard Time
UTC-11
Aleutian Standard Time
Hawaiian Standard Time
Marquesas Standard Time
...

-ListAvailable:$false behaves the same as -ListAvailable or -ListAvailable:$true, returning all available time zones.

Error details

No error is thrown. The cmdlet executes but ignores the explicit $false value.

Environment data

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.4
PSEdition                      Core
GitCommitId                    7.5.4
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions