PowerShell

The PowerShell forum accepts bug reports as well as feedback and suggestions. For more information, check out the PowerShell Homepage

The following is a list of the states we use to track items.

status meaning
survey We saw this and we are considering it. Please upvote if it’s important to you.
needs more information We don’t understand the issue and need additional details.
investigating We are looking at this internally to understand things like: scenario, reproduction of issue, costing, or other technical details.
in queue The issue is understood and in our unprioritized backlog. Your votes will be used to drive prioritization of this work.

Please feel free to provide feedback or file bugs here.

(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback
  1. Terminating error in if statement script block generates duplicate errorvariable entries

    Consider the following 2 functions (contrived to illustrate the issue).

    function 1error { [CmdletBinding()] Param(); throw "This produces 1" }
    function 2error { [CmdletBinding()] Param(); if($true) {throw "This produces 2"} }

    If you call the function 1error with an error variable, the error variable will act as expected.

    1error -ErrorVariable +1var
    $1var.count #results in 1

    If you call function 2error with an error variable, the error variable will have 2 identical errors.

    2error -ErrorVariable +2var
    $2var.count # results in 2

    PSVersion is 5.1.14393.2189

    4 votes
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)

      We’ll send you updates on this idea

      0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    • Inconsistent Array Initialization Behaviour

      Creating an array of arrays as below works well:

      $myArray = @(
      @(1,2,3),
      @(4,5,6)
      )
      $myArray[0] #outputs 1, 2, 3
      $myArray[1] #outputs 4, 5, 6

      $myBuggyArray = @(
      @(1,2,3)
      ,@(4,5,6)
      )
      $myBuggyArray[0] #outputs 1
      $myBuggyArray[3] #outputs 4, 5, 6

      I wouldn't expect the order of line break & comma to impact the behaviour of the command / can't find any documentation stating that it should.

      PSVersion: 5.1.14409.1012

      4 votes
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        Signed in as (Sign out)

        We’ll send you updates on this idea

        3 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
      • Windows 10 Build 17677 - Windows PowerShell lost cursor

        Windows 10 Build 17677 latest in Windows PowerShell it lost cursor

        1 vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          Signed in as (Sign out)

          We’ll send you updates on this idea

          1 comment  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
        • write-host -NoNewline parameter is ignored with powershell 5.1

          Starting with WMF 5.0 and WMF 5.1 the -NoNewLine option for Write-Host is essentially ignored.

          Simple example:
          PS C:\> Write-Host "no newline test " -NoNewline

          Current Behaviour:
          no newline test
          PS C:\>

          Expected Behavior
          no newline test PS C:\>

          PS version Table is as follows.

          Name Value
          ---- -----
          PSVersion 5.1.14409.1012
          PSEdition Desktop
          PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
          BuildVersion 10.0.14409.1012
          CLRVersion 4.0.30319.42000
          WSManStackVersion 3.0
          PSRemotingProtocolVersion 2.3
          SerializationVersion 1.1.0.1

          1 vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            Signed in as (Sign out)

            We’ll send you updates on this idea

            0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
          • switch break

            Switch should allow for implied breaks.

            I think it would be useful, if it doesn’t exist to have an additional option, e.g.

            switch -ImplyBreak ($variable) {
            ‘red’ { ‘r’ }
            ‘green’ { ‘g’ }
            }

            Where -ImplyBreak would make the code above equivalent to:

            switch ($variable) {
            ‘red’ { ‘r’; break }
            ‘green’ { ‘g’; break }
            }

            1 vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              Signed in as (Sign out)

              We’ll send you updates on this idea

              0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
            • Please modify clause ($var -in 1..3)

              Please modify clause ($var -in 1..3) not to use a list in memory.

              The code becomes unusable when using long ranges like 1..20000000

              Thanks

              1 vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                Signed in as (Sign out)

                We’ll send you updates on this idea

                0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
              • Powershell write-progress memory leak in remote sessions

                Hello, I have noticed some strange behavior with Powershell when run in a remote session, it seems as if there is a memory leak with write-progress when run in a remote session.

                Take the following code for example:

                $MaxVal = 10000000

                for ($x=1;$x -le $MaxVal;$x++)
                {
                Write-Progress -Activity "Writing a progress event" -PercentComplete ($x / $MaxVal * 100) -Status "$($x / $MaxVal * 100)% complete"
                }

                If I run this locally, powershell.exe runs normally and does not take up much memory.

                However, if I run it on the same computer from a remote session (as in, I do an enter-psesssion…

                1 vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  Signed in as (Sign out)

                  We’ll send you updates on this idea

                  0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                • Merge "Windows PowerShell" and "PowerShell Core", make result default on Windows

                  When sending code to someone, I don't want to have to qualify the post with "if it doesn't work, try the *other* PowerShell...". I know there will be OS-specific modules/commands, but there should *not* be two code bases for the shell itself, or two product names.

                  2 votes
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    Signed in as (Sign out)

                    We’ll send you updates on this idea

                    0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                  • Allow custom message when using the confirm parameter

                    Although PowerShell creates a message describing the action about to take place when using the confirm parameter, it would be helpful to have the ability to create a custom message in order to make the dialog more user friendly or provide more detail about what action is about to take place.

                    1 vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      Signed in as (Sign out)

                      We’ll send you updates on this idea

                      0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                    • Fatal error when using a class when the script is in the folder containing a single quote

                      Create a script called "C:\Temp'Test\Test.ps1" and add the following lines:

                      Write-Host "Test"
                      Class MyClass {}

                      Execute this script and you get this error:

                      The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) At line:1 char:1 + & 'C:\Temp''Test\Test..ps1' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], FileLoadException + FullyQualifiedErrorId : System.IO.FileLoadException

                      Rename the folder as simply C:\Test and it runs without an error.

                      1 vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        Signed in as (Sign out)

                        We’ll send you updates on this idea

                        0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                      • Graphical bug in PSVersion 5.1.16299.248

                        Hi there

                        I've never used the powershell very much. Today I discovered this graphical bug in the rendering of the console text output:
                        https://i.imgur.com/H40F15W.png
                        This bug was very confusing at first. Then it just kept getting more irritating.
                        The bug appears when I scroll up and down, at the bottom of the window. Sometimes text gets cut off at the sides too, but only if I change the window width.
                        I think I remember I had similiar issues years ago on a different computer.

                        I couldn't find anything related on google. Maybe I used the wrong search terms?

                        Although totally…

                        1 vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          Signed in as (Sign out)

                          We’ll send you updates on this idea

                          2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                        • Using DontShow for a parameter should not hide all CommonParameters from auto-complete

                          Using "DontShow = $true" for a parameter has the unexpected side effect of hiding all CommonParameters from auto-complete. The function below demonstrates the issue.

                          function Get-Foo {

                          [CmdletBinding()]
                          param(
                          [Parameter()]
                          [string]
                          $Visible,

                          [Parameter( DontShow = $true )]
                          [string]
                          $NotVisible
                          )

                          process {
                          Write-Verbose 'foo'
                          }

                          }

                          1 vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            Signed in as (Sign out)

                            We’ll send you updates on this idea

                            0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                          • BUG: The certificate for the WMF 5.1 setup has expired WMF 5.1 cannot be installed

                            The certificate for Win7AndW2K8R2-KB3191566-x64.msu has expire and installing WMF 5.1 fails with the following error in Event Log/Windows Logs/Setup

                            Windows update "Update for Windows (KB3191566)" could not be installed because of error 2148204801 "A required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file." (Command line: ""C:\Windows\system32\wusa.exe" "C:\Users\username\Downloads\Win7AndW2K8R2-KB3191566-x64\Win7AndW2K8R2-KB3191566-x64.msu" ")

                            Is WMF 5.1 still supported?

                            3 votes
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              Signed in as (Sign out)

                              We’ll send you updates on this idea

                              2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                            • Some new default cmdlet parameters?

                              We have -ErrorVariable and -WarningVariable. To capture verbose output to a variable, you can $VerboseRecords = (Write-Verbose -Verbose "test") 4>&1 # and find it in $VerboseRecords.Message, but wouldn't it make sense to add a -VerboseVariable? Maybe even a -WriteHostVariable?

                              3 votes
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                Signed in as (Sign out)

                                We’ll send you updates on this idea

                                2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                              • Import-Module does not work with binary modules in exe files

                                I've tried putting my commands in an exe module, but could not get this module loaded in PowerShell.

                                1) If I try to load my module as-is, e.g. an .exe file I get "The extension '.exe' is not a valid module extension. "

                                2) If I create a .psd1 manifest and put RootModule = 'MyModule.exe' there I get Object reference not set to an instance of an object.
                                at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleNamedInManifest(PSModuleInfo parentModule, ModuleSpecification moduleSpecification, String moduleBase, Boolean searchModulePath, String prefix, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, Boolean loadTypesFiles, Boolean loadFormatFiles, Object privateData, Boolean& found, String shortModuleName, Nullable`1 manifestLanguageMode)
                                at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath,…

                                1 vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  Signed in as (Sign out)

                                  We’ll send you updates on this idea

                                  0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                • [Bug] Bitwise AND operation on long value is ignored when Most-Significant 32 bits is masked with zero

                                  [Bug] Bitwise AND operation on long value is ignored when Most-Significant 32 bits is masked with zero

                                  Sample Code to replicate issue:

                                  [BitConverter]::GetBytes([BitConverter]::ToInt64(@(1,1,168,192,255,255,255,255), 0) -band 0x00000000ffffffff)

                                  Should return: @(1,1,168,192,0,0,0,0)
                                  Actually returns : @(1,1,168,192,255,255,255,255)

                                  4 votes
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    Signed in as (Sign out)

                                    We’ll send you updates on this idea

                                    1 comment  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Add 'StopExisting' as a valid argument for New-ScheduledSettingsSet -MultipleInstances

                                    Only Parallel, Queue, and IgnoreNew are supported right now. One would expect that the option available from the Task Scheduler GUI would be available in the powershell interface.

                                    Steps to reproduce

                                    $a = New-ScheduledTaskSettingsSet -MultipleInstances StopExisting

                                    Expected behavior

                                    The task's multiple instances policy is set to kill existing tasks before starting another instance.
                                    Actual behavior

                                    value "StopExisting" to type "Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum".
                                    Error: "Unable to match the identifier name StopExisting to a valid enumerator name. Specify one of the following
                                    enumerator names and try again:
                                    Parallel, Queue, IgnoreNew"
                                    At line:1 char:131
                                    + ... ngOnBatteries -ExecutionTimeLimit $b -MultipleInstances StopExisting
                                    + ~~~~~~~~~~~~
                                    + CategoryInfo…

                                    1 vote
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      Signed in as (Sign out)

                                      We’ll send you updates on this idea

                                      0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                    • PowerShell does not fully convert a hashtable passed to a PSCustomObject parameter

                                      When passing a hashtable to a function parameter that expects a PSCustomObject, PowerShell does not fully convert the hashtable to a PSCustomObject type.

                                      function Test-1 {
                                      param(
                                      [PSCustomObject] $Foo
                                      )

                                      Write-Host "`$Foo's type is: $( $Foo.GetType().Name )" -Fore Green
                                      Write-Host "`$Foo is a PSCustomObject: $( $Foo -is [PSCustomObject] )" -Fore Green
                                      Write-Host "`$Foo has these properties:" -Fore Green

                                      foreach ($prop in ($Foo | Get-Member -MemberType NoteProperty| Select -ExpandProperty Name))
                                      {
                                      Write-Host "`t$prop" -Fore Green
                                      }
                                      }

                                      PS C:\Users\dabelc> Test-1 -Foo ( @{ "CustomProp" = "Value" } )
                                      $Foo's type is: Hashtable
                                      $Foo is a PSCustomObject: True
                                      $Foo has these properties:

                                      1 vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        Signed in as (Sign out)

                                        We’ll send you updates on this idea

                                        0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                      • [BUG] addition error in assignment operator +=

                                        [Environment]

                                        Name Value
                                        ---- -----
                                        PSVersion 5.1.16299.15
                                        PSEdition Desktop
                                        PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
                                        BuildVersion 10.0.16299.15
                                        CLRVersion 4.0.30319.42000
                                        WSManStackVersion 3.0
                                        PSRemotingProtocolVersion 2.3
                                        SerializationVersion 1.1.0.1

                                        [Bug]

                                        Consider this code:

                                        [int]$end = 100
                                        [double]$Increment = 0.1

                                        1..$End | Foreach-Object {[double]$t += $Increment ; "$_ $t"}

                                        I'd expect the output always to give the line number and the current total, but look what happens at lines 60 and 101:

                                        >54 5.4
                                        >55 5.5
                                        >56 5.6
                                        >57 5.7
                                        >58 5.8
                                        >59 5.9
                                        >60 5.99999999999999
                                        >61 6.09999999999999
                                        >62 6.19999999999999
                                        >63 6.29999999999999
                                        >64 6.39999999999999
                                        >65 6.49999999999999
                                        ....
                                        96 9.59999999999998
                                        97 9.69999999999998
                                        98 9.79999999999998
                                        99 9.89999999999998
                                        100…

                                        1 vote
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          Signed in as (Sign out)

                                          We’ll send you updates on this idea

                                          2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Remote powershell should not return error for FileSystem validation

                                          SCENARIO
                                          On Machine1:
                                          SCHTASKS /Create /RU SYSTEM /SC ONSTART /TN "Map I drive" /TR "net use I: \\someServer\someShare somePassword /user:someDomain\someUser"

                                          On Machine2 run:
                                          $Script = { Write-Output "Hello world!" }
                                          Invoke-Command -ComputerName Machine1 -ScriptBlock $Script

                                          As a result you get "Hello world!" but also an error
                                          "Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed."

                                          The error belongs to I drive which should have been returned as a warning and not error. The invoke does not even use the I drive so why fail on it (we in this case dont even want the invoke to have access…

                                          1 vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            Signed in as (Sign out)

                                            We’ll send you updates on this idea

                                            0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3 4 5 19 20
                                          • Don't see your idea?

                                          Feedback and Knowledge Base