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. 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
    (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 →
  2. 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

    3 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 →
  3. 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
    (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 →
  4. 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
    (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 →
  5. Make Import-DSCResource dynamic keyword parameter -ModuleVersion mandatory or generate parsing warning

    Configurations expire when the DSCResource modules they import change. It would be very welcomed if a warning was generated by the pasrser when the Import-DSCResource keyword was used without specifying either the Fully Qualified Module Name (FQMN) or the ModuleVersion parameter/Argument pair. This would simplfy managing different versions of a configuration both on the build server as well consuming blog posts that have you guessing what version of the Module was being used.

    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 →
  6. 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&lt;System.Int32&gt; listObject { get; set; }
    }

    "@

    [string]$string = "1"

    $classWithList = New-Object TestClass

    $classWithList.listObject = $string

    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 →
  7. PS5: Get-Help <anycommand> -ShowWindow doesn't display help

    When executing "Get-Help <anycommand> -ShowWindow", the resulting window doesn't contain any help text.

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

    We’ll send you updates on this idea

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

    1 comment  ·  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. Can you add some stuff to Get-ClipBoard?

    I would have liked the default behaviour to be that an array of newline-split strings was returned from Get-ClipBoard. 97 % of the time I end up writing (Get-ClipBoard) -split "\r?\n" | ...... often filtering out empty elements - and that's just boring.

    In my own version I used -Raw for a string and nothing for an array/list.

    Of course you can't change that now in the 5.x version (or later, sigh, will this be our doom in some distant future), but can you maybe add at least -AsArray or similar? Make it so it can only be used with…

    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 →
  12. Fix .NET date formatting bug in .ToString()

    PS D:&gt; gcim win32_operatingsystem | % caption
    Microsoft Windows Server 2016 Standard

    PS D:&gt; $PSVersionTable.PSVersion

    Major Minor Build Revision


    5 1 14393 1358

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

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

    We’ll send you updates on this idea

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

    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 →
  14. 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.

    3 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 →
  15. 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&quot; 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
    (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 →
  16. Make the Continue statement work in ForEach-Object

    Within in ForEach-Object script block, "continue" behaves like "break", and one should use "return" to simulate "continue". But, from my perspective, it would make sense to give "continue" foreach-object awareness

    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. Bug: New-PSDrive mounts locally scoped, even though it is supposed to be across a powershell Session.

    Confirmed that PSDrive is only scope locally in the class method is was called in:

    Test Setup:

    Mount(): HKU, HKCC, HKCUHKLM in class method. Display PSDrive mounts.
    Call Test() within that Mount(), which mounts HKCR; Display PSDrive in method call.
    Display PSDrive mounts on Test() return
    Display PSDrive mounts on Mount() return
    Call Test() method from main, Display PSDrive mounts.
    Display PSDrive mounts on Test() return
    VERBOSE: Mounting registry drives for use ...
    VERBOSE: HKU
    VERBOSE: HKCC
    VERBOSE: HKCU
    VERBOSE: HKLM
    Alias C Cert Env Function HKCC HKCU HKLM HKU Variable WSMan (Scope: Mount())
    Alias C Cert Env Function HKCC…

    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 →
  18. Slow "." hash lookups

    Slow "." hash lookups (more than 100 times slower than []) from PowerShell Version 2 to Version 5.1

    This could be either a documentation problem or a bug. The documentation never says that the "." hash lookup can be much slower than the [] lookup. I hope it is a bug (one less thing to remember). They both worked at the same speed in PS Version 2.0 and diverged sometime after that.

    Two script files. The first calls the second forcing versions 1 thru 5 of PowerShell.

    The "." hash lookups in PS Version 2.0 take .028 seconds.
    The "."…

    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 →
  19. Provide a native ternary operator

    It would be very nice and convenient if PowerShell had a native ternary operator like C# does (https://msdn.microsoft.com/en-us/library/zakwfxx4(v=vs.100).aspx).

    Basically it would allow you to write a short-hand if-else statement, so instead of having to write:

    if ($someBoolCondition)
    {

    $x = $y.Property1
    

    }
    else
    {

    $x = $y.Property2
    

    }

    you could just write:

    $x = $someBoolCondition ? $y.Property1 : $y.Property2

    This operator is fairly standard in many programming languages, so it would be awesome if PowerShell could come up to speed with it as well. Thanks.

    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 →
  20. Do not require starting brace to be on same line as cmdlet

    It is very annoying and confusing that some cmdlets require the starting brace to be on the same line as the cmdlet, while others do not.

    For example, this is valid:

    ... | ForEach-Object {

    $sourcefile = $_.Name
    

    }

    but this is not:

    ... | ForEach-Object
    {

    $sourcefile = $_.Name
    

    }

    yet using this is valid:

    foreach ($x in $y)
    {

    $sourcefile = $_.Name
    

    }

    I know that you can use the backtick to make it valid, like this:

    ... | ForEach-Object `
    {

    $sourcefile = $_.Name
    

    }

    but that's still not intuitive and requires you to remember to do…

    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 →
1 2 5 7 9 22 23
  • Don't see your idea?

Feedback and Knowledge Base