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. Bug: Slow function when setting a parameter to Mandatory and specifying its Type

    There is a bug that causes a function to be called much more slowly than it should if an array parameter has both Mandatory and Type specified. I'm guessing something is causing the system to iterate through the array, so the larger the array, the longer to call the function.

    With both Mandatory and Type specified, it takes a whole second to call a function with a 10MB byte array. If a 1byte array is used, it takes less than a millisecond to call the function. If only one, the other, or neither are specified, then it takes less than…

    3 votes
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)

      We’ll send you updates on this idea

      0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    • Move-Item's -Verbose causes $ErrorActionPreference to be ignored

      Move-Items's -Verbose parameter causes the global $ErrorActionPreference = "Stop" to be ignored. This is a bug. Here's a repro script:

      BugRepro.ps1:

      $ErrorActionPreference = "Stop"
      Write-Host "ErrorActionPreference is $ErrorActionPreference"
      mkdir folder -ErrorAction SilentlyContinue | Out-Null
      "" > a.txt
      Copy-Item a.txt folder
      Write-Host "About to trigger error"
      Move-Item a.txt folder -Verbose | Out-Null
      Write-Host "If you're reading this, then execution didn't stop!"
      Write-Host "Remove the Verbose paramter and it does stop, like it should."

      2 votes
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        I agree to the terms of service
        Signed in as (Sign out)

        We’ll send you updates on this idea

        1 comment  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
      • Mandatory parameters value is not accessible in DynamicParam block if the value to the parameter is given when prompted.

        Parameter value from param block is not available in DynamicParam block if not passed while calling the function/Script. Here if I set the parameter in param block as it as mandatory the script/function will prompt for the input and the input given is not available in DynamicParam block.

        https://social.technet.microsoft.com/Forums/en-US/637bcff2-ab98-4ead-a036-38e7eb94a261/dynamicparams-with-mandatory-parameters?forum=winserverpowershell

        2 votes
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          I agree to the terms of service
          Signed in as (Sign out)

          We’ll send you updates on this idea

          0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
        • Fix .NET date formatting bug in .ToString()

          PS D:\> gcim win32_operatingsystem | % caption
          Microsoft Windows Server 2016 Standard

          PS D:\> $PSVersionTable.PSVersion

          Major Minor Build Revision
          ----- ----- ----- --------
          5 1 14393 1358

          PS D:\> [DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss')
          2017-07-27 12.29.37

          9 votes
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            I agree to the terms of service
            Signed in as (Sign out)

            We’ll send you updates on this idea

            10 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
          • Define which as one of standard aliases of Get-Command

            Users of Unix-like OSs(e.g. macOS & Linux) use the command `which` to know where the executable of a command is.

            ```
            $ which code
            /usr/bin/code
            ```

            On the other hand, users of PowerShell uses the commandlet `Get-Command` or the alias `gcm`.

            ```
            PS C:\> (gcm code).Path
            C:\Program Files\Microsoft VS Code\bin\code.cmd
            ```

            However, the users of Unix-like OSs have to learn `gcm` if they have to use PowerShell and want to know the place of a command, though they don't if they would like to, for example, change directories and show the contents of files because PowerShell defines the same aliases…

            2 votes
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              I agree to the terms of service
              Signed in as (Sign out)

              We’ll send you updates on this idea

              0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
            • [Bug] Command line parsing: spaces and \"

              This is my powershell version
              ==========
              $PSVersionTable
              Name Value
              ---- -----
              PSVersion 5.1.15063.674
              PSEdition Desktop
              PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
              BuildVersion 10.0.15063.674
              CLRVersion 4.0.30319.42000
              WSManStackVersion 3.0
              PSRemotingProtocolVersion 2.3
              SerializationVersion 1.1.0.1
              =====END=====

              Let's see a use scene
              ========== WindowsPowershell
              function FormatReg([string]$value)
              {
              $value = $value -replace '"', '\"'
              $value = '"' + $value + '"'
              return $value
              }
              $temp = FormatReg '"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" "if((Get-ExecutionPolicy) -ne ''AllSigned'') { Set-ExecutionPolicy -Scope Process Bypass }; & ''%1''"'
              reg.exe add HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\0\Command /f /d $temp
              =====END=====
              > Error: Invalid syntax.
              > Type register Add/? "Learn about usage information.

              ========== cmd
              reg.exe add HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\0\Command /f /d "\"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe\"…

              2 votes
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                I agree to the terms of service
                Signed in as (Sign out)

                We’ll send you updates on this idea

                1 comment  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
              • very inconsistent drive letter usage

                Hi there

                in this case I have to remove and reinstall an OS while booting from usb stick. But this is only one example - it´s not the first time im seeing this behaviour.

                if (Test-path c:) {Get-Volume -DriveLetter c | Get-Partition | Remove-PartitionAccessPath -AccessPath c:\}

                In this line the term C is used three times

                First time as c: (here would be c:\ also possible)
                Second time as c (neither c: nor c:\ is working here)
                Third time as c:\ (neither c nor c: is working here)

                I´m working with variables - this means I have to create 3…

                3 votes
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  I agree to the terms of service
                  Signed in as (Sign out)

                  We’ll send you updates on this idea

                  3 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                • Order of output not intuitive/ not sequential

                  Example Code:
                  $proc = Get-Process | Select-Object -Property ProcessName

                  $proc[5]

                  "A"
                  "B"
                  Write-Host "$proc[5]"

                  The output of Write-Host precedes the output of the strings beforehand. This is a non-sequential behaviour.

                  1 vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    I agree to the terms of service
                    Signed in as (Sign out)

                    We’ll send you updates on this idea

                    1 comment  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                  • copy-item progress

                    Add an optional switch to show the progress of an ongoing copy operation. Could be useful for large operation. Basically replicate as much information as the Explorer does, without the performance graph.

                    1 vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      I agree to the terms of service
                      Signed in as (Sign out)

                      We’ll send you updates on this idea

                      0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                    • [Bug] IE automation script will no longer work in PowerShell version 5

                      To be better notified of incoming tickets in our ticket system I developed a script that opens a hidden IE instance:

                      $ie = New-Object -ComObject InternetExplorer.Application
                      (I tried the respective registry entry and "$ie = new-object -Com InternetExplorer.ApplicationMedium", no better.)

                      (This input box is too small.)

                      After some script statements to log in and navigate to the incoming tickets monitor, I do a

                      $newcalls = $ie.Document.getElementsByName("callid")

                      (This input box is too small.)

                      That's working perfectly fine in PowerShell version 4, but in v5 I get

                      Exception from HRESULT: 0x800A138A
                      At <path>.ps1:89
                      char:5
                      + $newcalls = $ie.Document.getElementsByName("callid")
                      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      + CategoryInfo…

                      1 vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        I agree to the terms of service
                        Signed in as (Sign out)

                        We’ll send you updates on this idea

                        5 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                      • join-object

                        Hello,

                        Would it be possible to natively have the Join-Object command as explained on the following MSDN blog: https://blogs.msdn.microsoft.com/powershell/2012/07/13/join-object/

                        Being able to cross data so easily (especially with left join) would really be a plus I think.

                        thank you

                        1 vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          I agree to the terms of service
                          Signed in as (Sign out)

                          We’ll send you updates on this idea

                          0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                        • Add ExportTo-Markdown

                          Hi

                          Using Markdown is common nowadays in VCS tools like Git for readme files.

                          Plus it's handy to get a tabular strcture for better visibility.

                          Example use cases:
                          - Get-Process output comparison at different dates and time
                          - SQL query results in tabular form with column names as headers

                          So it'd be someInput|ExportTo-MarkDown

                          1 vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            I agree to the terms of service
                            Signed in as (Sign out)

                            We’ll send you updates on this idea

                            0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                          • Convert ToBase64 causes excessive memory usage

                            Converting most files (200 KB+) causes large memory usage. For instance, a 611 KB photo (one found in /Web/Wallpaper/Theme1) takes up 1 GB of RAM in PS.

                            [convert]::ToBase64String((get-content $path -encoding byte))

                            1 vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              I agree to the terms of service
                              Signed in as (Sign out)

                              We’ll send you updates on this idea

                              0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                            • PowerShell Crash Get-NetFirewallProfile when run as service

                              PowerShell crashes when running "Get-NetFirewallProfile | Select-Object LogFileName" by a windows service. In my case it was check_mk through a monitoring plugin.

                              1 vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                I agree to the terms of service
                                Signed in as (Sign out)

                                We’ll send you updates on this idea

                                0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                              • Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed

                                We are experiencing about 12 minutes wait time to start Powershell session because of disconnected network drive that didn't get clean up properly. It would be helpful for PowerShell to support ignoring drive or allow for timeout setting so we don't have to wait that long.

                                C:\Users\keatchan>time /t & powershell get-date
                                09:07 PM
                                Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.

                                Wednesday, October 18, 2017 9:19:05 PM

                                1 vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  I agree to the terms of service
                                  Signed in as (Sign out)

                                  We’ll send you updates on this idea

                                  0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                • We need a proper set of built-in, easy-to-use, dedicated registry cmdlets

                                  Managing registry keys and values on local and remote systems with PowerShell is a pain.

                                  Reviewing the articles, forums and blogs on the Internet clearly shows that new PowerShell users struggle to understand how to use registry provider drives and the cmdlets like New-Item, Get-ItemProperty, New-ItemProperty, and so on. This has prompted the creation of a variety of home-brew modules and functions to deal with the problem, like this one, which is extremely useful, but is not built into PowerShell by default of course:

                                  https://gallery.technet.microsoft.com/RegistryLibrarypsm1-b38a81ba

                                  PowerShell needs a proper set of built-in, dedicated registry cmdlets that 1) are easy to…

                                  26 votes
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    I agree to the terms of service
                                    Signed in as (Sign out)

                                    We’ll send you updates on this idea

                                    4 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Command line parsing bug: spaces and trailing slash

                                    There appears to be a bug parsing arguments to EXEs. If you pass a properly-quoted path that has spaces and a trailing slash, the rest of the command is lumped into the same argument. This also happens if you use a PowerShell variable to hold the path string.

                                    To repro, first, install EchoArgs.exe (if using chocolatey: cinst -y echoargs). It demonstrates what arguments would get passed to any exe.

                                    Then run:

                                    PS> & EchoArgs "C:\spaces and trailing slash\" more args

                                    Echo args shows that it all got lumped into one argument:

                                    Arg 0 is <C:\spaces and trailing slash" more args>

                                    6 votes
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      I agree to the terms of service
                                      Signed in as (Sign out)

                                      We’ll send you updates on this idea

                                      2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                    • using module <Module> does not work as expected

                                      I have a problem with loading classes from a module.

                                      Script is just two lines as following:
                                      using module AzureAD
                                      class TestClass { [Microsoft.Open.AzureAD.Model.Application] static DoIt() { return $null; } }

                                      If I run this, using .\Script.ps1 I get the following error:
                                      At C:\path\Script.ps1:3 char:20
                                      + class TestClass { [Microsoft.Open.AzureAD.Model.Application] static D ...
                                      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      Unable to find type [Microsoft.Open.AzureAD.Model.Application].
                                      + CategoryInfo : ParserError: (:) [], ParseException
                                      + FullyQualifiedErrorId : TypeNotFound

                                      However, if I run "using module AzureAD" from the command line first and then run the script, it works fine...

                                      What is the difference in running using module from…

                                      1 vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        I agree to the terms of service
                                        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 interpret set variables

                                        Powershell has (optionally) replaced cmd as a standard shell in Windows 10.

                                        However it is a pity that Powershell is not able to interpret commands that rely on usage of variables that are defined in "set"

                                        like %computername%, %windir%, %userprofile%, %appdata% etc
                                        etc

                                        Please respect your own system variables in use for decades Microsoft. Thank you a lot.
                                        There must be way without breaking this.

                                        try issuing a simple

                                        cd %appdata%

                                        in powershell (often used in KB articles), good luck and have fun (or not).

                                        Imho while I could understand limitations this is pretty odd.

                                        2 votes
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          I agree to the terms of service
                                          Signed in as (Sign out)

                                          We’ll send you updates on this idea

                                          5 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                        • PS 5 assigning to list value while PS 4 isn´t

                                          Hi!

                                          We recently got WMF 5.1 (KB3191566) that included PS 5.
                                          We then began finding differences in the behavior of PS 5 and PS 4 when running our scripts. The result was different.

                                          We didn´t notice this problem since someone wrapped it in a try catch block... So to recreate this issue/bug I made this script and ran it on one host with PS 5 and one VM host on PS 4.

                                          add-type -Language CSharpVersion3 -TypeDefinition @"
                                          public class TestClass
                                          {
                                          public System.Collections.Generic.List<System.Int32> listObject { get; set; }
                                          }
                                          "@

                                          [string]$string = "1"

                                          $classWithList = New-Object TestClass

                                          $classWithList.listObject = $string

                                          1 vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            I agree to the terms of service
                                            Signed in as (Sign out)

                                            We’ll send you updates on this idea

                                            1 comment  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3 4 5 17 18
                                          • Don't see your idea?

                                          Feedback and Knowledge Base