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. Classes do not support data hiding.

    I am grateful for the addition of classes in PS, and I know why PowerShell classes do not support true data hiding, but it is a significant shortcoming. It does not allow full control of setting a property for example. I can write my own class method for setting it, but it can be changed outside of that method. And if that method also updates the value of another class property, it can get changed directly, without going through the desired logic so the class method can be bypassed.
    And it is nice to have the get and set automatically…

    2 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 →
  2. 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
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    4 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  3. Add-Content should create folder but returns error

    According to this documentation Add-Content should create a folder when it does not exist: "This command creates a new directory and file and copies the content of an existing file to the newly created file."

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/add-content?view=powershell-5.1

    However, I get an error: "Add-Content : Could not find a part of the path 'C:\tests\test134\logs\test134.log'."

    Seems like a clear issue to me. Either in the documentation or the functionality.

    BR Matthias

    2 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 →
  4. 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
    (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 →
  5. Transcript does not log the Verbose and Warning stream of Receive-Job

    Problem

    When we run a job inside a transcript, the Verbose and the Warning streams of the jobs are not displayed in the transcript. However, we can see the in the console correctly.

    Steps to reproduce

    Run the following script
    Start-Transcript -Path 'C:\Logs\DemoJobsTranscriptOutput.txt' -Append | Out-Null

    $VerbosePreference = "continue"
    $WarningPreference = "continue"

    $jobs = @()

    $jobs += Start-Job -ScriptBlock {

    $VerbosePreference = "continue"
    
    $WarningPreference = "continue"
    "Begin job"
    Write-Verbose "Verbose!"
    Write-Warning "Warning!"
    "End job"

    } -Name "Demo"

    $jobs | Wait-Job | Out-Null

    $jobs | % {

    "Result for job '$($_.Name)'"
    
    $_ | Receive-Job -Verbose

    }

    $jobs | Remove-Job | Out-Null

    2 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. 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…

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

    We’ll send you updates on this idea

    4 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  7. 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."

    5 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 →
  8. [BUG] addition error in assignment operator +=

    [Environment]

    Name Value


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

    [Bug]

    Consider this code:

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

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

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

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

    1 vote
    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 →
  9. 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>

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

    We’ll send you updates on this idea

    4 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  10. [BUG] Drag and drop to scripts shortcuts split paths containing spaces

    Drag and dropping any file to a script shortcut split this path before passing the splitted strings as multiple parameters. Here's my detailed Issue Report :

    Steps to reproduce

    1 - Get any script, for example :
    [samplescript.psd1] :
    ```
    param([string]$path)

     Write-Host($path)
    
    pause


    or a simpler one-line sample:
    Write-Host($args);pause```

    2 - Create a shortcut that runs the script :
    [Shortcut Target ] : PowerShell &quot;path\to\our\samplescript.psd1&quot;

    3- Drag and drop a file containing spaces in its name to the shortcut
    [sample file ] : C:\Some file with spaces.txt

    Expected behavior

    Drag and dropping the file should pass its path to the…

    4 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 →
  11. 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
    (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 →
  12. 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

    204 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    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…

  13. 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
    (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 →
  14. Start-Process is behaving strange when -credential switch is used

    When running Start-Process start-process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -cred $(Get-Credential) regardless if the credentials differ from the current consoles credentials or the same credentials are used, the new console window seems to be unresponsive, until you switch back to the console from which the new console was launched and start typing something in that console.

    If the same thing is done in ISE, this issue does not occour.

    I have testet this on PS 5.1.14393.206, 5.1.14393.953 and 5.1.14393.693. Windows Server 2012R2, Windows Server 2016 and Windows 10

    Please see the issue in this video: https://goo.gl/8ZvdEV

    4 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 →
  15. Remote Powershell Session "-ErrorAction Stop" give Non-Terminating Error

    Script with Remote Powershell that are using Try/Catch and (of course) Terminating error, but for some reason under PSv5.1 Shell now those "-ErrorAction Stop" aren’t producing Terminating Error.

    I need to force $ErrorActionPreference = “Stop” to have my Try/Catch to work.

    2 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 →
  16. Resolve-Path returns null if the file name contains brackets

    To reproduce: Create a file: c:\temp[filename].txt

    $script = Get-ChildItem "C:\Temp[filename].txt"
    Resolve-Path $script

    Error:
    Resolve-Path : Cannot bind argument to parameter 'Path' because it is null.

    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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  17. Include UTC timestamp as property to error object

    It'd be very helpful to attach a timestamp of when an error occured to an error object. Open to ideas as to whether it should be UTC, local time, ntp, etc.

    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 →
  18. Get-Service should return the user account the services are running under

    The Get-Service cmdlet should return the service account associated to each service.

    We can get this information easily from the Win32_Service WMI class, but to me, it should be returned by Get-Service.

    Checked with PS v5 without luck...

    Thanks!

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

    We’ll send you updates on this idea

    7 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  19. Catch illegal syntax in array definition

    Today I had an issue where getting an element at a certain index in a typed array failed. As I was troubleshooting this issue I found that it was simply because I had used a '.' (dot) instead of a ',' (comma) to separate the elements when I defined the typed array variable.
    Okay, that is a clear mistake on my part. However, as I thought about it I would have loved to be alerted by the Powershell engine .

    -- Experienced on v5.1.14409.1012 of PowerShell
    
    -- Win7 x64 OS

    TO REPRODUCE:

    open vscode
    
    create ps1 file
    $array = &quot;hej&quot;,
    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  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  20. No StdOut output on console until second object

    Let me explain. I have a script that is collecting data, and I send it to StdOut by simply piping it into Select (but problem also happens if I add a ForEach loop and simply make [PSCustomObject] objects). Then my script loops to the next server. That output is not displaying on the screen. All is not lost though, when the script loops to the second server and displays both the first and second will now display. When the third server finishes it displays OK, as does the 4th.

    So it looks like it's just the first one. Normally I…

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

Feedback and Knowledge Base