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:New-PSDrive altering stored username in registry persistence entry when using credential object from different domain in UPN format

    # Steps to reproduce

    # Must use the format username@domain for username and be mapping share from different non-federated domain to reproduce
    $Cred = Get-Credential
    $Path = 'Path to the share'
    New-PSDrive -Name 'P' -PSProvider FileSystem -Root $Path -Persist -Credential $Cred -Scope Global

    # Expected behavior

    The $Cred.username value gets stored in the registry under HKEY_CURRENT_USER\Network\P
    in the UserName string value without alteration.

    # Actual behavior

    The domain of the system running the commands gets appended in the front of the username from the cred object when stored in the reg key.

    For example if $Cred.Username is 'username@Domain1.com'…

    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. "The script failed due to call depth overflow" in non-recursive function

    I have a filter in a script module that a does a little error formatting and flags the fact that it's seen an error. Most of the time, it seems to do its little job just fine. About once a week a sharing violation triggers some kind of infinite recursion and PowerShell emits the depth overflow error. The odd thing is that the function is not recursive. I've run procmon and I can see that the sharing violation happens just once - most of what happens after than is PowerShell writing to a pstrace log (I've wrapped the offending section…

    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 →
  3. New-NetIPAddress Prefixlength not working

    New-NetIpaddress in windows 10 1903 ent will not accept 27 as a prefix length

    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. get-childitem doesn't easily pipe full path to foreach_object

    This is already changed in PS 6. I think it would be very useful in PS 5.1. The string version of what get-childitem returns doesn't have the full path. I know $_.fullname would work, but it's more trouble. A lot of people ask about this.

    PS C:\users> get-childitem myuser\foo\ | foreach-object { get-content $_ }
    get-content : Cannot find path 'C:\users\hi.txt' because it does not exist.
    At line:1 char:47
    + get-childitem myuser\foo | foreach-object { get-content $_ }
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\users\hi.txt:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

    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. Unable to paste a Chinese character 𠮷 to PowerShell or output the character from c#.

    I tried command Write-Host "𠮷"(Unicode code point 20BB7) in PowerShell but I am unable to paste the character to PowerShell.
    PowerShell output "?" when I paste the character .
    How can I resolve this issue ? Thank you.
    More details here
    https://social.msdn.microsoft.com/Forums/zh-CN/9accaed3-fcc5-4207-a6fe-5c464a9b7597/how-can-i-output-a-chinese-character-when-its-unicode-code-point-greater-than-65535-in-powershell?forum=win10itprogeneral

    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 →
  6. BUG: Shell crashing with x509Certificate2 objects

    Problem:

    When creating an object from the x509Certificate class the shell adds 3 script properties:

    DnsNameList
    EnhancedKeyUsageList
    SendAsTrustedIssuer

    The SendAsTrustedIssuer property causes Powershell to hit a CLR exception and hard crash when accessed.

    Repro Code:

    * Note: do this in a fresh session as it will crash the session

    $Test = New-Object System.Security.Cryptography.x509Certificates.x509Certificate2
    $Test | select *

    Alternately,

    $Test = New-Object System.Security.Cryptography.x509Certificates.x509Certificate2
    $Test.SendAsTrustedIssuer

    Crash dump:

    Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at System.Management.Automation.Security.NativeMethods.CertGetCertificateContextProperty(IntPtr pCertContext, CertPropertyId dwPropId, IntPtr pvData, Int32& pcbData)
    at Microsoft.PowerShell.Commands.SendAsTrustedIssuerProperty.ReadSendAsTrustedIssuerProperty(X509Certificate2 cert)
    at CallSite.Target(Closure ,…

    4 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 →
  7. Invoke-Command does not respect -ErrorAction parameter

    Hey guys, this does not seem to be fixed. Is this by design? Invoke-Command does not respect -ErrorAction parameter which means it cannot be suppressed using SilentlyContinue nor can it be trapped using a Try..Catch block.

    This issue is present in both WinPS and PowerShell Core. Does not seem like intended behavior since the $Error[0] variable and $ResolutionError ErrorVariable are set by PowerShell outside of the scriptblock.

    Invoke-Command -ScriptBlock { Get-Content c:\file\does\not\exist.txt } -ErrorAction SilentlyContinue -ErrorVariable ResolutionError

    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. Mount-DiskImage fails with: "Access is denied" 0x5 occurred while reading the console output buffer

    After upgrade from Windows 1803 to Windows 1809 `Mount-DiskImage $iso_path` starts failing with the following error:

    ```
    Exception calling "EndProcessing" with "0" argument(s): "Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support Services."
    At line:352 char:17
    + $__cmdletization_objectModelWrapper.EndProcessing()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : HostException

    ```

    The powershell command is executed under Administrator user in packer. It actually mounts specified image path, but throws this exception on attempt to interact with stdout.

    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 →
  9. Ability to register a wrapper function to be called before a cmdlet is being executed

    Helpful for example to check if remote sessions are still healthy and re-open them in case they are broken.

    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. Query path language to query nested hash tables

    Expected:
    Directly use query path language to query nested hash tables

    Current:
    1. Convert the hash table into json
    2. Load json by Newtonsoft.Json
    3. use Json query language to query

    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. >> defaults to unicode no matter what the encoding of the original file is

    echo 'hi there' >> file.txt

    Even if file.txt is ansi encoding, this will append a line of unicode or utf-16 little endian text to the bottom of the file. I assume >> is an alias for "out-file -append".

    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 →
  12. && and || operators for conditional execution

    Add these essential operators that are an integral part of any other command line language (CMD, Bash, etc.)

    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. Allow expansion of columns in output

    For example, I type in Get-PrinterPort and press return. It shows me the output for all printers. However, I have one printer with a port (defined by Windows) as a really really long text string. The output in Powershell truncates it which renders the output utterly useless. I need a way to have output non-truncated

    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 get-childitem works unexpected differently

    Hi there

    Im working with WindowsPE and have to identify my USB-Drive.

    So I´m looking for the drive and assign a variable:

    $usb_drive = (Get-WmiObject -class Win32_LogicalDisk -filter DriveType=2 | Foreach {Get-ChildItem -Filter *.wim -r -d 1 $_.DeviceID} 2>$null | Where {$_.name -eq "boot.wim"}).PsDrive.Root

    With Powershell 5.1.14393.2791 its working as expected. With 5.1.18361.1 not.

    The reason is this part:

    Get-WmiObject -class Win32_LogicalDisk -filter DriveType=2 | Foreach {Get-ChildItem -Filter *.wim -r -d 1 $_.DeviceID}

    The Reason is handling of $_.Deviceid. On both versions the Result is c:

    On both versions Get-Childitem C: gets the entries of the local directory (which makes…

    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 →
  15. 'Using module' does not work when having multiple levels of inheritance

    When having more than one level of inheritance, 'Using module' does not work as expected.

    Example:

    Class A is defined in module A.
    Class B is defined in module B.
    Class C is defined in module C.

    A.psm1
    class A {}

    B.psm1
    Using module 'A'

    class B : A {}

    C.psm1
    Using module 'B'

    class C : B {}

    With the above example class C only inherits the properties and methods from B class and not from A class.

    The reason for separating the classes in different modules is to allow their reuse in other modules.

    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 →
  16. Write-Information does not show in a file transcribed by Start-Transcript

    Write-Information does not show in a file transcribed by Start-Transcript unless you set $InformationPreference to 'SilentlyContinue'... which then means it does not display in the console.

    I believe this is a bug in Windows PowerShell (as of v5.1.17134.590) that has been fixed in PowerShell Core? If we cannot go to Core I have to do some workarounds (like using Write-Host or creating a function that combines 2 Write-Information calls with different preferences).

    There looks like a better formatted thread here on this issue:
    https://stackoverflow.com/questions/55191548/write-information-does-not-show-in-a-file-transcribed-by-start-transcript

    Here's $PSVersionTable:
    ---------------------------------------------------------------------------
    PSVersion 5.1.17763.316
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.17763.316
    CLRVersion 4.0.30319.42000 …

    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. "using module" does not take variable as parameter

    The "using module" statement does not take a variable as a parameter for the module name, which is inconvenient if you're writing scripts based on taking modules from variable DFS paths based on the environment (usign different Active Directory forests as the root for the paths for instance).

    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. Merge "Windows PowerShell" and "PowerShell Core", make result default on Windows

    When sending code to someone, I don't want to have to qualify the post with "if it doesn't work, try the *other* PowerShell...". I know there will be OS-specific modules/commands, but there should *not* be two code bases for the shell itself, or two product names.

    15 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 →
  19. Move-AzureRmDataLakeStoreItem not working in newer versions of module

    I created a runbook on several automation accounts that move around files and folders on Datalake Storage Accounts (gen 1). The runbook works without hitches on 2 automation accounts, but did not work on the other 2.

    There were quite a few differences in the versions of the added modules: the runbook worked on the older versions of the modules, but not the newer. Specifically the cmdlet Move-AzureRmDataLakeStoreItem threw an error on the newer versions:
    "Account name ***.azuredatalakestore.net/ is invalid. Specify the full account including the domain name."

    After trying quite a few iterations of writing the account name (just…

    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 →
  20. ERROR: Select-Object with -First parameter populates -ErrorVariable even if there was no error

    If you run: 1..2 | select -ErrorVariable a
    then $a is empty - OK.

    If you run: 1..2 | select -First 2 -ErrorVariable a
    then in $a is "System error"

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

Feedback and Knowledge Base