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. 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 →
  2. 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 →
  3. log2(45/120) * 2 should be interpreted as (log2(45/120)) * 2

    Given a function:
    function log2 {param ([double]$x) [Math]::Log($x) / [Math]::Log(2) }

    Expected: log2(45/120) * 2 is interpreted as (log2(45/120)) * 2 and yields -2.83007499856

    Actual: log2(45/120) * 2 equals log2(45/120) and yields -1,41503749927884

    (log2(1/2) * 3) -eq (log2(1/2)) yields True - it doesn't make sense.

    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 →
  4. log2 45/120 should be valid syntax

    Given a function:
    function log2 {param ([double]$x) [Math]::Log($x) / [Math]::Log(2) }
    Expected: log2 45/120 should yield -1.41503749928
    Actual:
    log2 : Cannot process argument transformation on parameter 'x'. Cannot convert value "45/120" to type "System.Double".
    Error: "Input string was not in a correct format."
    At line:1 char:6
    + log2 45/120
    + ~~~~~~

    + CategoryInfo          : InvalidData: (:) [log2], ParameterBindingArgumentTransformationException
    
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,log2

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

    3 comments  ·  PowerShell Engine  ·  Flag idea as inappropriate…  ·  Admin →
  6. Fix LoadDefaultTypesFiles when using out of process runspace

    Fix for "Object reference not set to an instance of an object." when using LoadDefaultTypeFiles() with out of process runspace

    Reproduce:
    TypeTable.LoadDefaultTypeFiles()

    Reproduce underlying cause:
    Copy C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml to another name and run:
    var typeTable = new TypeTable(new List<string> { @"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types-debug.ps1xml" });
    Console.WriteLine(typeTable);

    The error is:
    "There were errors loading TypeTable. Look in the Errors property to get detailed error messages."
    , C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types-debug.ps1xml(3003) : Error in type "System.Security.AccessControl.ObjectSecurity": The "Type" node must have "Members", "TypeConverters", or "TypeAdapters".
    , C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types-debug.ps1xml(3036) : Error: CodeProperty should use a getter or setter method.
    , C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types-debug.ps1xml(3037) : Error: Unable to find type [Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase].
    , C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types-debug.ps1xml(3029) :…

    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 →
  7. code execution not synchronously when using "| Select-Object...."

    When using " | Select-Object......" then code execution behave like it's not running synchronously.
    Example:
    Get-WmiObject Win32NetworkAdapter | Where-Object {$.PhysicalAdapter -eq $true} | Select-Object DeviceID, Name
    Read-Host "Press key to continue"

    The result will be printed AFTER the Read-Host command, nut before as you would expect.

    A workaround is to add " | Out-Host"

    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. PSCredential prompts for credentials even without Credential() attribute.

    Steps to reproduce

    ```powershell
    function Test-CredentialAsString {

    Param (
    
    [Parameter()]
    [PSCredential]$Credential
    )
    $Credential.UserName

    }
    Test-CredentialAsString -Credential 'usernameAsString'
    ```

    Expected behavior

    Error:
    none
    Test-CredentialAsString : Cannot process argument transformation on parameter &#39;Credential&#39;. Cannot convert the &quot;usernameAsString&quot; value of type &quot;System.String&quot; to type &quot;System.Management.Automation.PSCredential&quot;.

    Actual behavior

    Prompts user for credentials (i.e. the same behaviour we'd expect had the [System.Management.Automation.Credential()] attribute been used.

    Environment data

    powershell
    &gt; (Get-WmiObject -class Win32_OperatingSystem).Version
    6.1.7601

    ```powershell
    > $PSVersionTable
    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

    ```

    (Related discussion on SO: https://stackoverflow.com/questions/47560421/change-behaviour-of-credentials-when-in-non-interactive-mode)

    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. Behaviour of `System.Management.Automation.Credential()` in NonInteractive session

    Steps to reproduce

    Demo.ps1

    ```powershell
    function Test-CredentialAttribute {

    Param (
    
    [Parameter()]
    [System.Management.Automation.PSCredential]
    [System.Management.Automation.Credential()]
    $Credential
    )
    $Credential.UserName

    }
    Test-CredentialAttribute -Credential 'usernameAsString'
    ```

    batchfile
    powershell -noninteractive -file &quot;c:\somewhere\Demo.ps1&quot;

    Expected behavior

    Error:
    none
    Test-CredentialAttribute : Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.

    Actual behavior

    Prompts user for credentials (i.e. the same behaviour we'd expect had the command been run in interactive mode.

    Environment data

    powershell
    &gt; (Get-WmiObject -class Win32_OperatingSystem).Version
    6.1.7601

    ```powershell
    > $PSVersionTable
    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

    ```

    (Related discussion…

    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. [Suggestion] Include Universal Dashboard features

    How about include in PowerShell Engine, the excellent features of Universal Dashboard by Adam Driscoll ?


    • Design of web dashboard using Powershell cmdlets

    • REST API exposure using Powershell cmdlets

    https://www.powershellgallery.com/packages/UniversalDashboard/
    https://poshtools.com/powershell-universal-dashboard/

    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 →
  11. copy-item progress

    Add an optional switch to show the progress of an ongoing copy operation. Could be useful for large operation. Basically replicate as much information as the Explorer does, without the performance graph.

    13 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. Mandatory parameters value is not accessible in DynamicParam block if the value to the parameter is given when prompted.

    Parameter value from param block is not available in DynamicParam block if not passed while calling the function/Script. Here if I set the parameter in param block as it as mandatory the script/function will prompt for the input and the input given is not available in DynamicParam block.

    https://social.technet.microsoft.com/Forums/en-US/637bcff2-ab98-4ead-a036-38e7eb94a261/dynamicparams-with-mandatory-parameters?forum=winserverpowershell

    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 →
  13. join-object

    Hello,

    Would it be possible to natively have the Join-Object command as explained on the following MSDN blog: https://blogs.msdn.microsoft.com/powershell/2012/07/13/join-object/

    Being able to cross data so easily (especially with left join) would really be a plus I think.

    thank you

    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. Define which as one of standard aliases of Get-Command

    Users of Unix-like OSs(e.g. macOS & Linux) use the command which to know where the executable of a command is.


    $ which code
    /usr/bin/code

    On the other hand, users of PowerShell uses the commandlet Get-Command or the alias gcm.


    PS C:\&gt; (gcm code).Path
    C:\Program Files\Microsoft VS Code\bin\code.cmd

    However, the users of Unix-like OSs have to learn gcm if they have to use PowerShell and want to know the place of a command, though they don't if they would like to, for example, change directories and show the contents of files because PowerShell defines the same aliases as commands in…

    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 →
  15. Bug: Slow function when setting a parameter to Mandatory and specifying its Type

    There is a bug that causes a function to be called much more slowly than it should if an array parameter has both Mandatory and Type specified. I'm guessing something is causing the system to iterate through the array, so the larger the array, the longer to call the function.

    With both Mandatory and Type specified, it takes a whole second to call a function with a 10MB byte array. If a 1byte array is used, it takes less than a millisecond to call the function. If only one, the other, or neither are specified, then it takes less than…

    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 →
  16. 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 →
  17. 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."

    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 →
  18. Order of output not intuitive/ not sequential

    Example Code:
    $proc = Get-Process | Select-Object -Property ProcessName

    $proc[5]

    "A"
    "B"
    Write-Host "$proc[5]"

    The output of Write-Host precedes the output of the strings beforehand. This is a non-sequential behaviour.

    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 →
  19. Convert ToBase64 causes excessive memory usage

    Converting most files (200 KB+) causes large memory usage. For instance, a 611 KB photo (one found in /Web/Wallpaper/Theme1) takes up 1 GB of RAM in 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. [Bug] Command line parsing: spaces and \"

    This is my powershell version

    $PSVersionTable
    Name Value


    PSVersion 5.1.15063.674
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.15063.674
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1
    =====END=====

    Let's see a use scene
    ========== WindowsPowershell
    function FormatReg([string]$value)
    {

    $value = $value -replace &#39;&quot;&#39;, &#39;\&quot;&#39;
    
    $value = &#39;&quot;&#39; + $value + &#39;&quot;&#39;
    return $value

    }
    $temp = FormatReg '"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" "if((Get-ExecutionPolicy) -ne ''AllSigned'') { Set-ExecutionPolicy -Scope Process Bypass }; & ''%1''"'
    reg.exe add HKEYCLASSESROOT\Microsoft.PowerShellScript.1\Shell\0\Command /f /d $temp
    =====END=====
    > Error: Invalid syntax.
    > Type register Add/? "Learn about usage information.

    ========== cmd
    reg.exe add HKEYCLASSESROOT\Microsoft.PowerShellScript.1\Shell\0\Command /f /d…

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

Feedback and Knowledge Base