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.
  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback
  1. Add a Duration column to the History output

    The output of Get-History has Start and End times which can be put together to calculate a Duration. Why not add that to the default formatting of history objects?

    As a workaround, I use these:
    https://gist.github.com/Jaykul/2d4dc5e4f5195c726368435055b8acdb

    5 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  1 comment  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  2. Add the ability for Join-Path to accept a single -Path and an array for -ChildPath

    If Join-Path handled a single base path and an array of child paths then you could easily process a list of relative paths.

    I would pass in:

    -Path "C:\MyTargetDirectory"
    -ChildPath ".\Sub1",".\Sub2",".\Sub2\Sub2.1",".\Sub2\Sub2.1\Sub2.1.1"

    and it would return the following:

    C:\MyTargetDirectory\Sub1
    C:\MyTargetDirectory\Sub2
    C:\MyTargetDirectory\Sub2\Sub2.1
    C:\MyTargetDirectory\Sub2\Sub2.1\Sub2.1.1

    If it isn't possible to create parameter sets that can cope with both methods then you could always create Join-ChildPath to simplify things.

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  3. Bug in PowerShell Invoke-sqlcmd - Inserting duplicate rows if the second row of SQL insert statement table name is wrong.

    Bug in PowerShell Invoke-sqlcmd - Inserting duplicate rows if the second row of SQL insert statement table name is wrong.
    Example:
    create table TestDB..TestTable
    (Id Int,
    InsertedDate Datetime default (getdate()))

    Run below script in PowerShell, which has table name wrong in second row.

    $Query = "Use TestDB
    Insert into TestTable (id) values ('1')
    Insert into TestTable2 (id) values ('2')"
    Invoke-sqlcmd -Query "$Query" -ServerInstance "SQLInstanceName"

    SQLResult:
    Id InsertedDate
    1 2016-09-15 03:35:12.587
    1 2016-09-15 03:35:12.590

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  4. Get-ComputerInfo should have remoting capabilities

    Get-ComputerInfo was introduced in PowerShell Desktop 5.1.14361.0 and provides the ability to return various information about the local computer. It would be very useful if this cmdlet could also query remote computers, without relying on PowerShell Remoting.
    For example:
    Get-ComputerInfo -ComputerName SRV01

    19 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  5. Allow using Select, Sort, Group, and Measure without a pipeple

    It should be possible to use Select-Object, Sort-Object, Group-Object, and Measure-Object without a pipeline.

    In those circumstances where a script needs to be optimized for speed, one of the first things to do is to eliminate pipelines because of the huge overhead they incur. Because of these four commands, eliminating all pipelines is sometimes impossible or requires coming up with complex alternatives to them.

    I would expect these two commands (or some variation of the second one) to produce the same result:

    2, 1, 3 | Sort-Object
    Sort-Object -InputObject 2, 1, 3

    Currently, the second line treats the array in…

    3 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  6. "Select-Object -Unique" and "Group-Object" should not have quadratic runtime

    De-duplicating a collection, or aggregating similar items in a collection, can be done in linear time via hash sets or hash tables, respectively.

    "Select-Object -unique" and "Group-Object", however, both use O(n^2) algorithms that rely only on equality, never leveraging hashing. It's literally faster (by a lot) to use "Sort-Object -Unique", which additionally does sorting.

    Blog post at http://latkin.org/blog/2016/08/02/curious-behavior-when-de-duplicating-a-collection-in-powershell/ has more explanation.

    It was suggested by Bruce P on Twitter that I open this bug: https://twitter.com/BrucePayette/status/760532657293832192

    2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  1 comment  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  7. Compress-Archive does not include hidden files/folders

    Creating an Archive with Compress-Archive does not include hidden files of folders.

    I would recommend to adapt the behavior of Windows internal compressed Zip functionality which is including hidden files by default.
    Additional i would prefere a sidenote in the documentation of

    8 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  1 comment  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  8. Tee-Object doesn't work in scripts/functions that support ShouldProcess

    Overview

    When Tee-Object is used in a function/script that supports ShouldProcess, it doesn't work. It appears that internally, Tee-Object uses Set-Variable, which does support ShouldProcess. Tee-Object itself doesn't support ShouldProcess, so you can't change the behavior with a -WhatIf:$false parameter.

    Steps to Reproduce

    function Invoke-TeeObject
    
    {
    [CmdletBinding(SupportsShouldProcess=$true)]
    param(
    )

    Get-ChildItem -Path $env:temp *.fubar | Tee-Object -Variable 'tempFilesFound' | Remove-Item -Recurse -Force

    Write-Output ('Removed {0} temporary text files.' -f $tempFilesFound.Count)
    }

    '' | Set-Content -Path (Join-Path -Path $env:Temp -ChildPath 'tee-object.fubar')
    Invoke-TeeObject -WhatIf

    Results in this output:

    What if: Performing the operation "Remove File" on target "C:\Users\ajensen\AppData\Local\Temp\tee-object.fubar".
    
    What if: Performing the operation
    2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  9. ConvertFrom-Csv has undocumented partial comment support

    When multiple strings are fed into ConvertFrom-Csv, it will ignore lines prefixed with a '#' character. When fed a single string, it retains those lines. Unless it is the first line, in which case it is ignored either way. This behavior happens whether sent through the pipeline or provided to the -InputObject parameter.

    The workaround is to use double quotes around the item with the leading '#'.

    I guess this comes from handling the optional type information. The check for the "#TYPE" seems to happen only once with the single string, and every time when given multiple strings.

    Choose either…

    3 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  10. Add eval alias to Invoke-Expression to PowerShell core

    Adding an eval alias to the PowerShell core, pointing to the Invoke-Expression command, would help to improve compatibility with Bash scripts on Linux.

    2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  11. Unable to Enable credssp remotely

    I am trying to execute the below command to enable credssp remotely but it is giving below error and blocking our execution in prod. Can some one suggest me how to enable it.

    Invoke-Command -ComputerName Server1 -Credential domain\user1-ScriptBlock {

    Enable-WSManCredSSP -Role Server -Force
    Enable-WSManCredSSP -Role Client -DelegateComputer * -Force

    }
    Access is denied.

    + CategoryInfo          : InvalidOperation: (:) [Enable-WSManCredSSP], Inv 
    

    alidOperationException

    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.EnableWSMa 
    

    nCredSSPCommand

    + PSComputerName        : civautowinclu02
    

    Access is denied.

    + CategoryInfo          : InvalidOperation: (System.String[]:String[]) [En 
    

    able-WSManCredSSP], InvalidOperationException

    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.EnableWSMa 
    

    nCredSSPCommand

    + PSComputerName        : Server1
    

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  12. Non-closing Out-Gridview for running custom functions

    When writing scripts for endusers without powershell - knowledge the Out-Gridview -PassThru is a great way of providing a GUI for a user menu. You can find a good example here:
    https://mcpmag.com/articles/2016/02/17/creating-a-gui-using-out-gridview.aspx

    Many times the user just wants to 'Run' what he selects with a 'Run' Button without closing the view. The problem with the current Out-Gridview -PassThru is that the view closes after you click OK or Cancel. So we need to create a loop around it to make the Out-Gridview start all over again. Pretty crude but it works.

    I'm not sure how easy that is but I'm…

    6 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    3 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  13. some unicode display none

    ps 5.0 bug:some unicode display none

    【Cause of the bug】
    unknown

    【bug with powershell version】
    powershell 2.0: no this bug
    powershell 3.0: no this bug
    powershell 4.0: no this bug
    powershell 5.0: have this bug
    ise in win10 10586:no this bug

    【test code】
    write-host 'a♦♣♥♠b'

    【how to fix】
    unknown

    【reporter】
    By the chinese powershell study & research group. QQ group No. is 183173532

    【date】
    2016-06-04

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  3 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  14. Fix the remotedesktop module

    It seems that the RemoteDesktop module for RDS isn't working correctly. When trying to configure constrained endpoints in powershell it seems nearly impossible to restrict the session to only use the RemoteDesktop-module. It appears as if the modules isn't loading in a constrained endpoint due do the use of aliases in the modules.

    https://powershell.org/forums/topic/creating-jea-endpoint-for-remote-desktop-services/

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    investigating  ·  0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  15. Get-Service Name parameter allows Null value

    Get-Service -Name $Null returns all services. Expected behavior would be for Name to have ValidateNotNullOrEmpty attribute assigned.

    4 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    3 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  16. Get-Winevent - Execution with only -MaxEvents parameters specified

    When executing the Get-Winevent cmdlet with only the -MaxEvents parameter specified the cmdlet ends up in an infinite loop spewing errors:

    Get-WinEvent -MaxEvents 1

    Get-WinEvent : The data is invalid
    At line:1 char:9
    + $null = Get-WinEvent -MaxEvents 1
    + ~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-WinEvent], EventLogInvalidDataException
    
    + FullyQualifiedErrorId : The data is invalid,Microsoft.PowerShell.Commands.GetWinEventCommand

    I reproduced this error on PowerShell 5.1 and 4.0 on multiple systems. The behavior I expected was to receive the most recent event from any of the event logs. I feel this error could be prevented by using proper parameter validation.

    3 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  17. Invoke-RestMethod fails to convert large JSON requests

    Invoke-RestMethod fails to convert large JSON requests.
    "For JavaScript Object Notation (JSON) or XML, Windows PowerShell converts (or deserializes) the content into objects."

    If the request is large, Invoke-RestMethod returns just a string. This isn't documented anywhere and there's no way to change the limit. This could be related to: https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088000-convertfrom-json-doesn-t-allow-you-to-modify-the-m

    4 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  18. New Cmdlet(s) for AG Lease Events

    MSSQL Tiger Team gave a great presentation today about new extended events and properties for troubleshooting AoAG. These improvements rely on AG Lease & X-events. It would be great to have a set of Cmdlets added to the AG modules to return information captured by AG-Lease a few examples:

    Get-AGDiagnosticEvent
    Get-AGLeaseExpired
    Get-AGLeaseSystemComponent

    1 vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →

    We will forward the request, but this is really something you want to send to the SQL Server team. They develop the PowerShell cmdlets for SQL. I would recommend that you send this request to the people who gave the presentation, as feedback from the presentation.

  19. Invoke-RestMethod ignores ErrorAction parameter

    If a request made using Invoke-RestMethod receives a 400 or 500 error, it just calls Write-Error and always fails irrespective of the value of the ErrorAction parameter.

    4 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  20. Resolve-Path should take [-Container] [-Leaf] [-Provider <string>]

    -Leaf only returns paths that resolve to leaf nodes
    -Container only returns paths that resolve to container nodes
    -Provider only returns paths that resolve to the provider specified

    As an example of why this is useful, the Get-FileHash cmdlet has the following code:

    begin {
    
    $hasher = [System.Security.Cryptography.HashAlgorithm]::Create($Algorithm)
    }
    process {
    $pathsToProcess = @()

    if($PSCmdlet.ParameterSetName -eq &#39;LiteralPath&#39;) {
    $pathsToProcess += Resolve-Path -LiteralPath $LiteralPath | Foreach-Object ProviderPath
    } else {
    $pathsToProcess += Resolve-Path $Path | Foreach-Object ProviderPath
    }

    foreach($filePath in $pathsToProcess) {
    if (Test-Path -LiteralPath $filePath -PathType Container) {
    continue
    }
    ...
    }
    }

    which can be simplified (and made more…

    2 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  0 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  • Don't see your idea?

Feedback and Knowledge Base