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 "Compile" verb

    PowerShell needs a Compile verb, especially in a world of DevOps. Looking at the approved verb list, there are mediocre subtitutes that could be used in its place (Start-Compilation, Invoke-Compile, etc.), but these all use an inappropriate verb with the a variant of the verb in the noun. When the verb is finding its way into the noun, it's time for a new verb. Please add Compile to the list of approved verbs in an upcoming release.

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

    We’ll send you updates on this idea

    8 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    survey  ·  Zachary Alexander responded

    Thank you for your input. Based on its current ranking compared to other feedback items and product schedule, work on this item is pending (and will be driven by) further customer input.

  2. Allow splatting without an intermediate variable.

    instead of
    $splat = @{name = "value"}
    verb-noun @splat

    Allow verb-noun @{name = "value"}

    This would make for a much cleaner and more natural look to parameters. Letting them be in the usual place of after and below the function.

    There is a stackoverflow question relating to this, that should explain it more - http://stackoverflow.com/questions/35188172/why-do-i-need-to-splat-to-a-variable-first

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

    We’ll send you updates on this idea

    16 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
    survey  ·  Zachary Alexander responded

    Thank you for your input. Based on its current ranking compared to other feedback items and product schedule, work on this item is pending (and will be driven by) further customer input. If you did not open this issue and are also impacted by it, please vote this item up.

  3. Allow Environment Variable as default value for function parameter.

    When defining a function, I would like to use an environment variable as the default value. If the environment variable exists and has a value that value will be used. For example,

    function Get-Info ([Alias("name")] [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [string] $projectName = $env:Project_Name)
    {
    }

    Instead of having to passing in the Project Name for each call I would like to store it in an environment variable. When I do it would allow me to call Get-Info with no parameters and the value in the environment variable would be used. If the environment variable does not exist or is empty the user…

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

    We’ll send you updates on this idea

    3 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  4. Bug in Show-Command

    Scriptblock parameters are interpreted as a [bool] value and is shown as a listbox with values $true or $false

    Code to reproduce:

    Show-Command -Name Invoke-Command

    Scriptblock parameter is shown as a [bool] listbox

    Cheers

    Tore

    14 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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  5. Add Format method to all output streams

    When returning strings to the host, for example by using throw or inputting a standard string into code such as: $var = 'Hello world'
    We're able to use the format method to insert variables like so:

    $var1 = 'World'
    'Hello {0}' -f $var1

    To keep this style of formatting consistent across PowerShell itself (and also C#) can the format method be added to other output streams such as Write-Verbose, Information , Output etc.

    This would provide an easier learning curve for anyone with experience in other languages and would also be a lot nicer to look at as opposed to…

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

    We’ll send you updates on this idea

    2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  6. BUG: PSBoundParameters contains values from PREVIOUS pipeline input

    When writing functions that take ValueFromPipelineByPropertyName, and accepting pipeline input, if some of the pipeline input is missing some properties, PSBoundParameters contains the previous value... incorrectly reporting the parameter was passed in:

    For example:

    function Get-UserName {
    [CmdletBinding()]
    param(

    [Parameter(ValueFromPipelineByPropertyName,Mandatory)]
    
    $Last,

    [Parameter(ValueFromPipelineByPropertyName)]
    $First

    )
    process {

    if($PSBoundParameters.ContainsKey('First')) {
    
    Write-Host -Foreground Red $PSBoundParameters['First'] $PSBoundParameters['Last'] " " -NoNewLine
    $First[0] + $Last
    } else {
    $Last
    }

    }
    }

    $Users = [PSCustomObject]@{ First = "Ethan"; Last = "Hunt" }, [PSCustomObject]@{ First = "Jason"; Last = "Bourne" }, [PSCustomObject]@{ Last = "Bond" }

    $Users | Get-UserName

    9 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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  7. Suggestion: Allow explicit hexadecimal casts to [UInt32]

    I find it frustrating that there is no simple method of casting a 32-bit number with its high order bit set. For example consider the following number - 0x80000001:

    [UInt32] 0x80000001 <- throws an exception because it is implicitly converted to an Int32 which then cannot be converted to a UInt32.

    Various workarounds:
    * [UInt32] '0x80000001' <- String conversion. This operation is unnecessarily expensive.
    * [UInt32] 0x80000001L <- Downcast an Int64 to a UInt32.
    * [UInt32] 0x80000001 -band [UInt32]::MaxValue <- Perform bit math to force the conversion while preserving the bits.

    Proposed fix:

    As Jason Shirk suggested, it would probably…

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

    We’ll send you updates on this idea

    survey  ·  3 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  8. PowerShell fails to start if path contains brackets

    In a variety of cases, attempting to launch PowerShell from a path containing square brackets either fails entirely, or fails to resolve the relative working directory. For example:

    With this command, PowerShell won't launch:

    PS C:\T[e]st> Start PowerShell

    Start : Cannot perform operation because the wildcard path C:\T[e]st did not resolve to a file.
    
    At line:1 char:1
    + Start PowerShell
    + ~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (C:\T[e]st:String) [Start-Process], FileNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.StartProcessCommand

    From CMD or Powershell, this command starts Powershell, but with the wrong working directory:

    C:\T[e]st> PowerShell

    Windows PowerShell
    
    Copyright (C) 2015 Microsoft Corporation. All rights reserved.

    PS…

    6 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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  9. 6 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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  10. Cmdlet for getting list of Installed Software via Registry instead of win32_product.

    Would be great to have a builtin Cmdlet for getting list of Installed Software via Registry instead of win32_product.

    Why win32product is bad:
    https://sdmsoftware.com/group-policy-blog/wmi/why-win32
    product-is-bad-news/

    It would be faster, and would not trigger validation of all installed packages.

    Would use the following regkeys to return list of software (name, version, installDate) on local or remote machine (requires Remote Registry to be enabled on remote machine).

    HKLM:\Software\microsoft\windows\currentVersion\Uninstall
    HKLM:\Software\wow6432node\microsoft\windows\currentVersion\Uninstall

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

    We’ll send you updates on this idea

    1 comment  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →

    Will watch for folks to add their voices to this.
    In the meantime, if there is someone who wants to publish a user-contributed item to the PowerShell Gallery that does this, it would certainly be welcomed.

  11. Bug: Move-Item

    Noticed a bug with the "Move-Item" cmdlet.

    Example:
    The source folder and destination folder have different permissions sets.

    $src = "C:\Path\To\Source&quot;
    $dest = "D:\Path\To\Dest"

    ForEach($file in $src)
    {

      Move-Item $($file.fullname) -destination $dest
    

    }

    Using this block of code to move files from one folder to another will result in the files not inheriting permissions from the destination folder.

    The files that were moved retain the permissions from the source folder.

    This doesn't happen with Copy-Item or when you drag / drop files.

    Workaround I found is to add "icacls $dest /T RESET" to the end of the script.

    6 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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  12. Please make -NoTypeInformation the default for Export-CSV

    I'm pretty sure that Export-CSV is used for creating Excel compatible files far more often than it is used for Serialising and Deserialising Type-consistent PS Objects.

    Alternatively / additionally adding a PS preference variable to set the default behaviour.

    I understand that this is simply a convenience thing, eliminating the need to add an extra parameter for the most common use case.

    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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  13. Job cmdlets fail with UTF-8 codepage

    Powershell jobs (eg, Start-Job, Wait-Job, Receive-Job) fail when Powershell's codepage is set to UTF8.

    Simple reproduction on Server 2012R2 w/ PS5:
    from cmd.exe, set the parent process codepage and start powershell with:

    chcp 65001
    powershell

    from the powershell that just started:
    $job = Start-Job -ScriptBlock { Write-Output yo }
    Receive-Job $job -Wait

    The Receive-Job call will fail with: "
    [localhost] The background process reported an error with the following message: Cannot process an element with node type "Text". Only Element and EndElement node types are supported. at
    System.Management.Automation.Remoting.OutOfProcessUtils.ProcesData(String data, DataProcessingDelegates callbacks).

    + CategoryInfo          : OpenError: (localhost:String) [], PSRemotingTransportException
    
    + FullyQualifiedErrorId
    5 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    survey  ·  4 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  14. new parameter -markdown for Format-Table

    Example:

    $Get-Process | select -First 5 | ft -au

    Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName


    716     47 32832 43396   587          1764 AdminManagerClient
    
    257 34 3432 9352 84 1128 AgentService
    495 78 15700 28528 154 3744 AppVClient
    244 35 60952 41796 692 0.56 5416 AppVStreamingUX
    591 18 17280 22992 108 1,751.98 4672 audiodg

    $Get-Process | select -First 5 | ft -markdown

    |Handles|NPM(K)|PM(K)|WS(K)|VM(M)| CPU(s)| Id|ProcessName |
    |-------|------|-----|-----|-----|--------|----|------------------|
    | 716| 47|32832|43396| 587| |1764|AdminManagerClient|
    | 257| 34| 3432| 9352| 84| |1128|AgentService |
    | 495| 78|15700|28528| 154| |3744|AppVClient |
    | 244| 35|60952|41796| 692| 0.56|5416|AppVStreamingUX |
    | 591| 18|17280|22992| 108|1,751.98|4672|audiodg |

    This could be…

    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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  15. Code completion pollutes $Error

    PowerShell v5

    Start a clean session:
    PowerShell -NoProfile

    Type the following characters:
    [cmd=

    and press Tab. The code is not completed, this is fine.

    But the global error collection $Error contains an error:
    The specified wildcard character pattern is not valid: [cmd=*

    Code completion should avoid such noise errors. They distract and may make an
    illusion that some user code produces them. Time may be lost on finding the
    actual culprit.

    4 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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  16. PS 5.0 Bug: Transcript stops after restarting a remote computer using ‘Restart-Computer’ with '-Wait' parameter.

    PS 5.0 Bug: Transcript stops after restarting a remote computer using ‘Restart-Computer’ with '-Wait' parameter.

    Example script:
    Start-Transcript c:\test.log
    $computername = "Fred"
    $credential = (get-credential "domain\user")

    Restart the remote computer.

    Restart-Computer -ComputerName $computername -Credential $credential -protocol WsMan -WsmanAuthentication Default -force -wait -for powershell -erroraction stop
    Stop-Transcript

    My tests were performed in the following environment - the source computer is Windows 7 SP1 with PowerShell 5.0, the target is Windows 7 SP1 with PowerShell 4.0.

    Upon completion of the reboot, the transcription is stopped. This is recorded in the transcript log file as “Windows PowerShell transcript end”. This results in 'Stop-Transcript'…

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

    We’ll send you updates on this idea

    survey  ·  2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  17. Properly handle multi-line commands when read from stdin (and stdin is not a tty)

    If Powershell is reading scripts from stdin, when executed using "Powershell -Command - ", then it exits as soon as it sees a multi-line statement. This can be solved by adding an extra newline, but this should not be necessary if stdin is not a tty, and definitely not if "-NonInteractive" is specified.
    Further details and investigation here: http://stackoverflow.com/questions/37417613

    4 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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  18. Provide Intellisense/Template for Manifests

    When creating a Manifest (.psd1), it would be handy to have Intellisense or at least a Template available.

    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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  19. ValidateSet doesn't accept constants like it says it does

    When running the below script on Windows 10 PowerShell 5.0.10586.494, it crashes with an error stating that the argument isn't a constant even though it is:

    Set-Variable -Option Constant ConstantVariable 'c'
    Set-Variable -Option Constant ConstantArrayVariable @('c')

    function Test-ValidateSet {

    param(
    
    [ValidateSet($ConstantVariable)]
    $p1,

    [ValidateSet($ConstantArrayVariable)]
    $p2
    )

    }

    At C:\tmp\Test-ValidateSet.ps1:7 char:22
    + [ValidateSet($ConstantVariable)]
    + ~~~~~~~~~~~~~~~~~
    Attribute argument must be a constant or a script block.
    At C:\tmp\Test-ValidateSet.ps1:10 char:22
    + [ValidateSet($ConstantArrayVariable)]
    + ~~~~~~~~~~~~~~~~~~~~~~
    Attribute argument must be a constant or a script block.

    + CategoryInfo          : ParserError: (:) [], ParseException
    
    + FullyQualifiedErrorId : ParameterAttributeArgumentNeedsToBeConstantOrScriptBlock

    This is an important feature for me because I…

    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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  20. RunspacePool handle and memory leaks (no leaks in v2)

    Invoke the below script. In the infinite loop it creates runspace pools and
    uses them for invoking jobs. In the end of each iteration script outputs
    the process handle count and private memory size.

    In PS v5.1 the handle count and memory size constantly increase.
    In PS v2.0 these leaks are not observed.

    -----8<-----

    $sw = [System.Diagnostics.Stopwatch]::StartNew()
    
    $count = 0
    for() {
    $pool = [RunspaceFactory]::CreateRunspacePool(1, 2)
    $pool.Open()

    $ps1 = [PowerShell]::Create()
    $ps1.RunspacePool = $pool
    $job1 = $ps1.AddScript(&#39;&quot;job1 $(Get-Date)&quot;&#39;).BeginInvoke()

    $null = $job1.AsyncWaitHandle.WaitOne()
    $ps1.EndInvoke($job1)

    $ps1.Dispose()
    $pool.Close()

    ++$count
    $p = Get-Process -Id $PID
    &quot;$($p.HandleCount) $($p.PrivateMemorySize64 / 1mb) $($count / $sw.Elapsed.TotalSeconds)&quot;
    }

    -----8<-----

    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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
← Previous 1 3
  • Don't see your idea?

Feedback and Knowledge Base