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. Inconsistent Array Initialization Behaviour

    Creating an array of arrays as below works well:

    $myArray = @(
    
    @(1,2,3),
    @(4,5,6)
    )
    $myArray[0] #outputs 1, 2, 3
    $myArray[1] #outputs 4, 5, 6

    $myBuggyArray = @(
    @(1,2,3)
    ,@(4,5,6)
    )
    $myBuggyArray[0] #outputs 1
    $myBuggyArray[3] #outputs 4, 5, 6

    I wouldn't expect the order of line break & comma to impact the behaviour of the command / can't find any documentation stating that it should.

    PSVersion: 5.1.14409.1012

    7 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 →
  2. Graphical bug in PSVersion 5.1.16299.248

    Hi there

    I've never used the powershell very much. Today I discovered this graphical bug in the rendering of the console text output:
    https://i.imgur.com/H40F15W.png
    This bug was very confusing at first. Then it just kept getting more irritating.
    The bug appears when I scroll up and down, at the bottom of the window. Sometimes text gets cut off at the sides too, but only if I change the window width.
    I think I remember I had similiar issues years ago on a different computer.

    I couldn't find anything related on google. Maybe I used the wrong search terms?

    Although totally…

    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 →
  3. 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 →
  4. BUG: Is it an error or not an error; Inconsistent output and error message

    The following codes were extracted to test a simple $arrayName += $NewObject code that kept replacing the entire array with each new $NewObject.

    *** START

    $dataArray = @() # Array to store data
    $outputProperty = @{
    Hostname = $Null
    IPv4 = $Null
    MAC = $Null
    MACDesc = $Null
    }

    $dataObject = New-Object -TypeName PSObject -Property $outputProperty

    $dataObject.Hostname = 'Computer 1'
    $dataObject.IPv4 = '111.111.111.1111'
    $dataObject.MAC = '11:11:11:11:11:11'
    $dataObject.MACDesc = 'NIC 1'

    "Content of dataObject: $dataObject"

    Line 1 **********

    $dataArray += $dataObject
    "Content of dataArray: $dataArray"

    $dataObject.Hostname = 'Computer 2'
    $dataObject.IPv4 = '222.222.222.222'
    $dataObject.MAC = '22:22:22:22:22:22'
    $dataObject.MACDesc = 'NIC 2'

    "Content of…

    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 →
  5. get-childitem should show listed directory, not the current one

    reproduce:
    go, for example, to c:\windows directory and type

    get-childitem c:\users

    -> get-childitem first line says Directory: c:\windows, and then it lists users directory contents. Is this intended behavior? If it is, it's quite confusing. Same with earlier versions. This is also very confusing when using filter to search subdirectories.

    I would expect "directory:" to show the listed directory's name, not the current.

    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. 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 →
  7. Inconsistent behaviour with [System.Environment]::GetFolderPath in Invoke-Command

    Invoke-Command somepc.somedomain.net -credential Administrator -Scriptblock {

    ([System.Environment]::GetFolderPath("MyDocuments") + "\WindowsPowerShell\Modules")
    

    }

    Run on a remote computer as-is this returns the module path for the Administrator user, as expected. However...

    Invoke-Command somepc.somedomain.net -credential Administrator -Scriptblock {

    Write-Output ([System.Environment]::GetFolderPath("MyDocuments") + "\WindowsPowerShell\Modules")
    

    }

    This instead returns the path for MY account, lgulliver, running locally. You get the same result passing this to New-Item and presumably other cmdlets.

    Running PS v5, remoting to both v4 and v5.

    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. Low performance when transferring long arrays between PSSessions

    I faced with the problem when I tried to recive long array (file system entries) from remote pssession. It is obvious that Powershell has problems with it.
    For reproduce it you should run next code:

    $session = New-PSSession localhost

    $arrayLen = 1024000
    Measure-Command{
    Invoke-Command -Session $session -ScriptBlock {

    Write-Host ("Preparing test array {0} elements length..." -f $using:arrayLen)
    
    $global:result = [Byte[]]::new($using:arrayLen)
    [System.Random]::new().NextBytes($result)

    }
    } |% {Write-Host ("Completed in {0} sec`n" -f $_.TotalSeconds)}

    Measure-Command{
    Invoke-Command -Session $session -ScriptBlock {

    Write-Host ("Transfer array ({0})" -f $using:arrayLen)
    
    return $result

    } | Out-Null
    } |% {Write-Host ("Completed in {0} sec`n" -f $_.TotalSeconds)}

    Measure-Command{
    Invoke-Command -Session…

    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 →
  9. [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

    2 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  10. Implement `runas.exe` counterpart with `netonly` and `NoNewWindow` switches

    I need to open Powershell console (within the same window) as different user with /netonly option known from the runas.exe command. I would like to avoid typing manually passwords, because I will use this console to run some scripts automatically.

    As far as I know if it currently impossible.
    I added appropriate question on SO: https://stackoverflow.com/questions/48882958/powershell-open-new-console-as-different-user-in-the-same-window-runas-neto

    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: The certificate for the WMF 5.1 setup has expired WMF 5.1 cannot be installed

    The certificate for Win7AndW2K8R2-KB3191566-x64.msu has expire and installing WMF 5.1 fails with the following error in Event Log/Windows Logs/Setup

    Windows update "Update for Windows (KB3191566)" could not be installed because of error 2148204801 "A required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file." (Command line: ""C:\Windows\system32\wusa.exe" "C:\Users\username\Downloads\Win7AndW2K8R2-KB3191566-x64\Win7AndW2K8R2-KB3191566-x64.msu" ")

    Is WMF 5.1 still supported?

    3 votes
    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 →
  12. Some new default cmdlet parameters?

    We have -ErrorVariable and -WarningVariable. To capture verbose output to a variable, you can $VerboseRecords = (Write-Verbose -Verbose "test") 4>&1 # and find it in $VerboseRecords.Message, but wouldn't it make sense to add a -VerboseVariable? Maybe even a -WriteHostVariable?

    3 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 →
  13. BUG: PowerShell stderr redirect to file inserts newlines

    If I run the following command in PowerShell:

    $ .\longerrormessage.exe 2>error.txt

    , I get spurious newlines in error.txt. I generated a full repro and extremely clumsy solution at [1]. Can we declare this behavior as a bug? Note that cmd.exe operates exactly as one would expect.

    [1] https://stackoverflow.com/questions/48655624/powershell-stderr-redirect-to-file-inserts-newlines

    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 →
  14. [Bug] Bitwise AND operation on long value is ignored when Most-Significant 32 bits is masked with zero

    [Bug] Bitwise AND operation on long value is ignored when Most-Significant 32 bits is masked with zero

    Sample Code to replicate issue:

    Should return: @(1,1,168,192,0,0,0,0)
    Actually returns : @(1,1,168,192,255,255,255,255)

    4 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. Powershell Core on IBM Power-series Hardware

    With Powershell Core v6 in GA status, it would be nice to see it scaled to other architecture, including OpenPOWER (This would include IBM's Power8 and the more recent Power9 hardware). This would allow management of OSes on that hardware with Powershell Core.

    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. Alias $PSVersionTable.PSVersion to a sensible command

    Determining the version of powershell requires the memorization of this silly, circuitous command: $PSVersionTable.PSVersion

    Can we please alias this to something more rational. I'm tired of googling "powershell version command" every time I forget the name of the table.

    It would be much better to have something guessable like:

    powershell --version

    or

    help version

    etc.

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

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

    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 →
  19. Bug: ExecutionPolicy not in effect for network drives

    I have downloaded a script from the Internet. Under the current "RemoteSigned" execution policy, this script should not run. But, it does run. Why is that?

    https://gallery.technet.microsoft.com/scriptcenter/Get-Type-Get-exported-fee19cf7
    Windows knows it is from the Internet because of the Zone.Identifier ADS.

    PS H:\src\test> Get-Item .\Get-Type.ps1 -Stream *

    PSPath : Microsoft.PowerShell.Core\FileSystem::H:\src\test\Get-Type.ps1::$DATA
    PSParentPath : Microsoft.PowerShell.Core\FileSystem::H:\src\test
    PSChildName : Get-Type.ps1::$DATA
    PSDrive : H
    PSProvider : Microsoft.PowerShell.Core\FileSystem
    PSIsContainer : False
    FileName : H:\src\test\Get-Type.ps1
    Stream : :$DATA
    Length : 4631

    PSPath : Microsoft.PowerShell.Core\FileSystem::H:\src\test\Get-Type.ps1:Zone.Identifier
    PSParentPath : Microsoft.PowerShell.Core\FileSystem::H:\src\test
    PSChildName : Get-Type.ps1:Zone.Identifier
    PSDrive : H
    PSProvider : Microsoft.PowerShell.Core\FileSystem
    PSIsContainer : False
    FileName : H:\src\test\Get-Type.ps1
    Stream : Zone.Identifier
    Length : 26

    PS…

    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. PS history file (ConsoleHost_history.txt) should include a timestamp

    In bash, there are tricks to include the time when a command was executed (https://www.cyberciti.biz/faq/unix-linux-bash-history-display-date-time/)
    It would be cool to include a timestamp in PS history too

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

Feedback and Knowledge Base