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. "Using module" statement does not reload module after changes are made

    Problem Description
    ------------------
    If you are using the `using module` statement, it will load the module without any issues. However, if you make a change to the module and run the `using module` statement again without restarting your PowerShell session, it will not load the new modified module into memory, and instead will continue to use the old existing module that was loaded. This makes doing development with `using module` statements very tedious as you must continually reload your PowerShell session whenever you make changes to the module.

    Ideally we would just use `Import-Module -Name [module name] -Force` to avoid…

    22 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 →
    • Remote Invoke-Command with -ScriptBlock changes types of arguments if scripblock contains variables

      What's going on here???

      PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Write-Host hi} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name}
      ScriptBlock
      PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Write-Host hi} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name; $a=3}
      String
      PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Get-ChildItem} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name}
      ScriptBlock
      PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Get-ChildItem} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name; $a=3}
      String

      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

        5 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
      • RequiredModules statement in Module Manifests should allow for Verbose:$false to be included

        Currently module imports initiated via the RequiredModules statement in a Module Manifest do not allow for verbosity preference.

        This results in a lot of additional noise for end users.
        For example. If a DSC Resource module requires other modules, and imports them via RequiredModules in the Module Manifest then the following happens:

        If an end-user is attempting to troubleshoot their DSC configuration they will utilize

        Start-DscConfiguration -UseExisting -Verbose -Force

        The results will be a verbose line for every cmdlet imported/exported from every included module. Which is A LOT of noise surrounding the verbose messages actually relevant to the end user.

        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 →
        • "The script failed due to call depth overflow" in non-recursive function

          I have a filter in a script module that a does a little error formatting and flags the fact that it's seen an error. Most of the time, it seems to do its little job just fine. About once a week a sharing violation triggers some kind of infinite recursion and PowerShell emits the depth overflow error. The odd thing is that the function is not recursive. I've run procmon and I can see that the sharing violation happens just once - most of what happens after than is PowerShell writing to a pstrace log (I've wrapped the offending section…

          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 →
          • BUG: Shell crashing with x509Certificate2 objects

            Problem:

            When creating an object from the x509Certificate class the shell adds 3 script properties:

            DnsNameList
            EnhancedKeyUsageList
            SendAsTrustedIssuer

            The SendAsTrustedIssuer property causes Powershell to hit a CLR exception and hard crash when accessed.

            Repro Code:

            * Note: do this in a fresh session as it will crash the session

            $Test = New-Object System.Security.Cryptography.x509Certificates.x509Certificate2
            $Test | select *

            Alternately,

            $Test = New-Object System.Security.Cryptography.x509Certificates.x509Certificate2
            $Test.SendAsTrustedIssuer

            Crash dump:

            Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
            at System.Management.Automation.Security.NativeMethods.CertGetCertificateContextProperty(IntPtr pCertContext, CertPropertyId dwPropId, IntPtr pvData, Int32& pcbData)
            at Microsoft.PowerShell.Commands.SendAsTrustedIssuerProperty.ReadSendAsTrustedIssuerProperty(X509Certificate2 cert)
            at CallSite.Target(Closure ,…

            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

              0 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
            • Write-Information does not show in a file transcribed by Start-Transcript

              Write-Information does not show in a file transcribed by Start-Transcript unless you set $InformationPreference to 'SilentlyContinue'... which then means it does not display in the console.

              I believe this is a bug in Windows PowerShell (as of v5.1.17134.590) that has been fixed in PowerShell Core? If we cannot go to Core I have to do some workarounds (like using Write-Host or creating a function that combines 2 Write-Information calls with different preferences).

              There looks like a better formatted thread here on this issue:
              https://stackoverflow.com/questions/55191548/write-information-does-not-show-in-a-file-transcribed-by-start-transcript

              Here's $PSVersionTable:
              ---------------------------------------------------------------------------
              PSVersion 5.1.17763.316
              PSEdition Desktop
              PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
              BuildVersion 10.0.17763.316
              CLRVersion 4.0.30319.42000 …

              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 →
              • "using module" does not take variable as parameter

                The "using module" statement does not take a variable as a parameter for the module name, which is inconvenient if you're writing scripts based on taking modules from variable DFS paths based on the environment (usign different Active Directory forests as the root for the paths for instance).

                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 →
                • Move-AzureRmDataLakeStoreItem not working in newer versions of module

                  I created a runbook on several automation accounts that move around files and folders on Datalake Storage Accounts (gen 1). The runbook works without hitches on 2 automation accounts, but did not work on the other 2.

                  There were quite a few differences in the versions of the added modules: the runbook worked on the older versions of the modules, but not the newer. Specifically the cmdlet Move-AzureRmDataLakeStoreItem threw an error on the newer versions:
                  "Account name ***.azuredatalakestore.net/ is invalid. Specify the full account including the domain name."

                  After trying quite a few iterations of writing the account name (just…

                  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 →
                  • && and || operators for conditional execution

                    Add these essential operators that are an integral part of any other command line language (CMD, Bash, etc.)

                    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 →
                    • Private methods in powershell class's don't work

                      For reference: https://docs.microsoft.com/en-us/powershell/wmf/5.0/class_newtype#methods

                      Creating private methods following the documentation does not work. To reproduce follow the following steps:

                      * Open Powershell or the ISE
                      * Copy the code from microsoft documentation
                      * if ISE: The interface will alarm indicating problems
                      * Execute documented test code
                      * Observe several errors complaining about code syntax and missing brackets.

                      You can also repro by adding the private designation to any working method of an existing class and it will bomb.

                      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 →
                      • SMTPEventConsumer doesnt format message body properly

                        I found a bug in PS 4.0 when working with SMTPEventConsumers. The bug I found truncated the string used for the "Message" property of the SMTPEventConsumer. The code truncated anything after the first 16 characters. It didn't matter what I used for an escape sequence, formatted as here string, nothing worked. I ran the exact same code on a PS 5.1 host and the SMTP message was formatted exactly as expected. For more indepth info I have included a link to the thread I started on TechNet for this issue.

                        https://social.technet.microsoft.com/Forums/en-US/62c4552b-b5e8-4bf3-ac74-6c5f1668af9f/issues-properly-formatting-smtpeventconsumer-message-body-in-powershell?forum=ITCG

                        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 →
                        • Transfer $DebugPreference and $VerbosePreference to New-PSSession

                          I want a PSSessionOption that says to transfer over common applicable session level variables over to the remote session, specifically $DebugPreference and $VerbosePreference.
                          $DebugPreference = 'continue'
                          $PSSession = New-PSSession -ComputerName 'localhost'
                          Write-Debug $DebugPreference # Writes 'continue'
                          Invoke-Command -ScriptBlock {Write-Debug $DebugPreference} -Session $PSSession # Writes nothing

                          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.

                            9 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 →
                            • ERROR: Select-Object with -First parameter populates -ErrorVariable even if there was no error

                              If you run: 1..2 | select -ErrorVariable a
                              then $a is empty - OK.

                              If you run: 1..2 | select -First 2 -ErrorVariable a
                              then in $a is "System 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 →
                              • 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…

                                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

                                  0 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…

                                  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 →
                                  • PowerShell StackOverFlowException: get-childitem -path HKLM:\ -recurse -include *Windows*

                                    PowerShell has a bug in it which causes a "StackOverFlowException" when running the following command:
                                    get-childitem -path HKLM:\ -recurse -include *Windows*

                                    It was originally reproduced while looking for something different than:
                                    Windows

                                    This is consistently reproducible in latest updates applied of Windows 10 x64 Business and Home, with both PowerShell.exe, and ISE, x86 and standard.

                                    $PSVersionTable.PSVersion

                                    Major Minor Build Revision
                                    ----- ----- ----- --------
                                    5 1 16299 98

                                    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

                                      3 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

                                      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 →
                                      • Out-DataTable

                                        Creates a DataTable based on an objects properties. Useful for converting any Powershell object into a DataTable which then can be bulk imported into a SQL Server table.

                                        .EXAMPLE
                                        $dt = Get-PSDrive | Out-DataTable
                                        This example creates a DataTable from the properties of Get-Alias and assigns output to $dt variable

                                        This idea comes from Chad Miller's Out-DataTable: https://gallery.technet.microsoft.com/scriptcenter/4208a159-a52e-4b99-83d4-8048468d29dd#content

                                        197 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

                                          19 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →

                                          After much discussion with Aaron Nelson and Chrissy LeMaire, and thanks to the enormous amount of support for this item, we’ve recognized that this is something we need to accomplish, one way or another.

                                          We don’t want to offer an ETA on this as the work is not well understood by our team yet, and no one currently has immediate bandwidth on starting that investigation. But I want to stress the fact that is an important ask that we’re taking seriously as a priority.

                                          In the meantime, it would be immensely useful if someone with expertise in the DataTable space could submit an RFC (basically a brief spec) to our PowerShell-RFC repository on GitHub. That way, we can have a discussion about what the design of a ConvertTo-DataTable cmdlet might look like before we dive in on an implementation. The process for doing so is located here: https://github.com/PowerShell/PowerShell-RFC/blob/master/RFC0000-RFC-Process.md#draft

                                          I…

                                        • Write-Host -NoNewLine and Transcription

                                          Starting with WMF 5.0 the -NoNewLine option for Write-Host is essentially ignored in the transcripts created using Start-Transcript.

                                          Simple example script:

                                          Start-Transcript log.txt
                                          Write-Host -NoNewLine "this should all"
                                          Write-Host -NoNewLine "be on one line"
                                          Write-Host -NoNewLine "in the log.txt file"
                                          Stop-Transcript

                                          12 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 →
                                          ← Previous 1 3 4 5 21 22
                                          • Don't see your idea?

                                          Feedback and Knowledge Base