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. Issue with running commands on remote machine

    Hi Team,

    I am using powershell to trigger commands on remote machine (as this doesn't require anything additional package to install). Recently I am facing issues with running commands on remote machine.

    $ComputerName = "..."

    Function ExecuteCommand() {

    Get-PSDrive
    

    }

    Set-Item WSMan:\localhost\Client\Trustedhosts -Value $ComputerName -Concatenate -Force
    
    

    $Credentials = Import-Clixml $CredentialsFile

    Invoke-Command -ComputerName $ComputerName -Credential $Credentials -ScriptBlock ${function:ExecuteCommand} -HideComputerName

    I am storing the credentials in the file and using the above script to run commands on remote machine.


    1. Get-PSDrive doesn't return mapped network drive details.

    2. using net use command to map network path. Network path gets mapped…
    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. 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 →
  3. Code analysis inside of a try block in a class thinks a variable isn't assigned when it is.

    Import-Module says that $variable2 is not assigned, but there is no way to reach its usage in the Write-Host without the variable having a value.

    Class MyClass {

    DoThing() {
    
    $variable1 = "var1"
    try {
    $variable2 = "var2"
    } finally {
    Write-Host "Tidying"
    }

    Write-Host $variable1
    Write-Host $variable2
    }

    }

    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. "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 this…

    39 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. Backport Powershell 6.x to Windows Powershell

    To keep Windows Powershell up to date please backport any new features from Powershell 6.x to Windows Powershell.

    7 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 →
  6. 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. format-volume whatif

    format-volume with option -whatif not working. It's should "Shows what would happen if the cmdlet runs. The cmdlet is NOT RUN."

    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 →
  8. Start-Process EncodedCommand (RedirectStandardError) v5.1

    The following script demonstrates an issue I'm experiencing after moving from PowerShell v4 to v5.1. I make extensive use of Start-Process redirecting StandardError to a file, if this file contains data after execution I can read the file to see what the issue was.

    However, with v5.1 when the launched PowerShell process starts, it makes use of progress output which is on the error stream, so this is redirected to the error file.

    In previous versions of PowerShell this did not happen.

    The output to the script below is as follows:

    Powershell v4

    WARNING: Standard Error
    WARNING: Standard Out
    hello…

    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. Support CamelHumps for tab completion

    CamelHump tab autocompletion would be nice, e.g., cd CH<tab> would expand to CamelHump if a directory by that name existed. This would be nice for any directories in CamelCase.

    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 →
  10. provide switches for toggles

    admit it, PS is ugly. with the multitudes of loops we have to jump thru to get a desired result, it would be better if you could provide command line switches for common tasks.

    for example, in a select statement, how do you prevent the header from appearing in the output? would be nice if could just do "select -NoHeader …." but you can't.

    that is just one example where I spent 30 minutes looking for a way to display only without headers in a "select" statement. a lot of our searches involves either an object has or has not…

    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 →
  11. Bug: -Exclude does not work as -Include does in Get-ChildItem, or as expected

    Three folders; d1, d2, d3, with files test.txt and test.mp3 in in d1 and d3.

    '-Include d1' includes only content from d1. Would expect '-Exclude d1' to include the inverse, but it has no effect, it returns all data.

    unless it's run after -Include.

    So '-Include d1 -Exclude d1' returns nothing, as expected.

    Exclude only works as it applies to a file name, not a path.

    So '-Exclude .txt' will exclude all files '.txt' as expected.

    The syntax usage in the help file is identical for both parameters.

    Please fix -Exclude parameter so that it works…

    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. Order is wrong in subsequent execution of loops

    Let's take this simple loop:

    PS C:\temp> for ($a=0; $a -lt 2; $a++ ) {
    >> get-date;
    >> Write-Host "Hello world!";
    >> Get-ChildItem | ft -a;
    >> sleep 1
    >> }

    18 juillet 2018 14:54:47
    Hello world!

    Directory: C:\temp
    

    Mode LastWriteTime Length Name


    -a---- 2018-07-18 14:49 3698 test.txt

    Hello world!
    18 juillet 2018 14:54:48

    Directory: C:\temp
    

    Mode LastWriteTime Length Name


    -a---- 2018-07-18 14:49 3698 test.txt

    As you can see, "Get-Date" and "Hello world!" gets inverted.

    If we remove "ft -a" everything is executed as it should.

    Using While ($true) { ... } does the exact same thing.

    Tested on Powershell…

    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 →
  13. Powershell not interpreting spaces correctly

    I am running a powershell script in the Post-Build event in Visual Studio (VS). Here is a simplified version of the command command

    powershell -ExecutionPolicy remotesigned -File "%SampleDir%\update.ps1" "$(ProjectDir)" "$(TargetName)" "$(TargetExt)" "$(Configuration)"

    I want you to understand that I have no control of these macro's $(ProjectDir) ... VS will fill these in.

    To simplify things I've eliminated VS. Here is a script that simply echo's the input given to it. This will show the problem copy the below script to a file called echo-args.ps1

    ===================================

    "The number of parameters passed in is $($Args.Count)"
    $i = 0
    foreach ($arg in $Args)…

    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. Timing Invoke-WebRequest Is Slower in Console than ISE

    We are running a home-grown internet speedtest using a PowerShell script. When running the script in ISE on fast network connections (100mbps+), the Invoke-WebRequest commands run fast enough to reflect 100mbps. However, when the script is run through console, the Invoke-WebRequest is restricted and reports speeds of only 25mbps. How can the console be configured to run with the same resources as ISE?

    FYI, this is not an issue for slower networks. Only fast networks seem to expose the console bottleneck.

    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 →
  15. 1 vote
    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 →
  16. write-host -NoNewline parameter is ignored with powershell 5.1

    Starting with WMF 5.0 and WMF 5.1 the -NoNewLine option for Write-Host is essentially ignored.

    Simple example:
    PS C:> Write-Host "no newline test " -NoNewline

    Current Behaviour:
    no newline test
    PS C:>

    Expected Behavior
    no newline test PS C:>

    PS version Table is as follows.

    Name Value


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

    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 →
  17. switch break

    Switch should allow for implied breaks.

    I think it would be useful, if it doesn’t exist to have an additional option, e.g.

    switch -ImplyBreak ($variable) {

    ‘red’ { ‘r’ }
    
    ‘green’ { ‘g’ }

    }

    Where -ImplyBreak would make the code above equivalent to:

    switch ($variable) {

    ‘red’ { ‘r’; break }
    
    ‘green’ { ‘g’; break }

    }

    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. Please modify clause ($var -in 1..3)

    Please modify clause ($var -in 1..3) not to use a list in memory.

    The code becomes unusable when using long ranges like 1..20000000

    Thanks

    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. Powershell write-progress memory leak in remote sessions

    Hello, I have noticed some strange behavior with Powershell when run in a remote session, it seems as if there is a memory leak with write-progress when run in a remote session.

    Take the following code for example:

    $MaxVal = 10000000

    for ($x=1;$x -le $MaxVal;$x++)
    {

    Write-Progress -Activity "Writing a progress event" -PercentComplete ($x / $MaxVal * 100) -Status "$($x / $MaxVal * 100)% complete"
    

    }

    If I run this locally, powershell.exe runs normally and does not take up much memory.

    However, if I run it on the same computer from a remote session (as in, I do an enter-psesssion…

    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. Windows 10 Build 17677 - Windows PowerShell lost cursor

    Windows 10 Build 17677 latest in Windows PowerShell it lost cursor

    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 →
  • Don't see your idea?

Feedback and Knowledge Base