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. While passing a json stream to a out file PS fails while cmd succeeds. Ending '}' bracket is missing.

    # Steps to reproduce
    1. I use a tool called rabtap to publish messages to rabbitMQ. Tool can be found here: https://github.com/jandelgado/rabtap
    2. When I tap on an exchange and redirect output to a file.
    -> It comes OK when I use this cmd on cmd prompt (i.e., as here): rabtap tap "myexchange:" --json > c:\tmp\usingCMDline.txt"
    -> However if I redirect the output using powershell, I miss out the ending bracekt in the output file. rabtap tap "myexchange:" --json | Out-File "c:\tmp\ps02.txt" (see attached output)
    # Expected behavior
    Full JSON should output, as done by the cmd line redirect operator.

    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. BUG: Powershell .net class loads slow since MS-Security Update April 2019

    Since May 2019 Security Rollup for Windows Server 2016, access to .net object via powershell is very slow, when a powershell variable breakpoint is set in the powershell.

    For example loading speed of [System.Environment] takes over ten times with breakpoint set against no breakpoint set.

    Since the behavior only occurs with latest security updates installed (May 2019 (KB4494440) or June 2019 (KB4503267)) i think it is related to the update.

    Did some troubleshooting with procmon until now. For me it looks like when PSBreakpoint is set, there are multiple reads from HKLM\System\CurrentControlSet\Control\Session Manager\Environment\__PSLockdownPolicy can't repoduce this when there is no…

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  3. Brackets Treated As Special Characters In Single Quotes

    # Steps to reproduce

    In File Explorer on an NTFS volume, create the file: [abc].txt

    Following this run:

    PS> ls '[abc].txt'

    # Expected behavior

    Directory: C:\Users\Dave

    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    -a---- 2019-05-06 12:07 AM 0 [abc].txt

    # Actual behavior

    No output displayed.

    # Environment data

    Name Value
    ---- -----
    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
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1

    # Additional Cases and Information

    The file name can be displayed using tab completion, but the brackets are preceded by back ticks, which indicates that Windows can see…

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  4. Get-ChildItem -LiteralPath doesn't support long path

    Get-ChildItem -LiteralPath doesn't support long path, for example:

    Get-ChildItem -LiteralPath 'D:\aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjjkkkkkkkkkkllllllllllmmmmmmmmmmnnnnnnnnnnooooooooooppppppppppqqqqqqqqqqrrrrrrrrrrssssssssssttttttttttuuuuuuuuuuvvvvvvvvvvwwwwwwwwwwxxxxxxxxxxyyyyyyyyyyzzzzzzzzzz.txt'

    Which path is longer than 260 bytes, even if the file DO exists in that path.

    But `Get-ChildItem` WITHOUT `-LiteralPath` works well with that long-path file.

    $PSVersionTable

    Name Value
    ---- -----
    PSVersion 5.1.17763.134
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.17763.134
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1

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

    We’ll send you updates on this idea

    2 comments  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  5. RequiredModules statement in Module Manifests should allow for Verbose:$false to be included

    Currently module imports initiated via the RequiredModules statement in a Module Manifest do not allow for verbosity preference.

    This results in a lot of additional noise for end users.
    For example. If a DSC Resource module requires other modules, and imports them via RequiredModules in the Module Manifest then the following happens:

    If an end-user is attempting to troubleshoot their DSC configuration they will utilize

    Start-DscConfiguration -UseExisting -Verbose -Force

    The results will be a verbose line for every cmdlet imported/exported from every included module. Which is A LOT of noise surrounding the verbose messages actually relevant to the end user.

    5 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: New-VirtualDiskClone not working

    The example is not working:
    New-VirtualDiskClone -VirtualDiskFriendlyName archive -FriendlyName archive2019 -TargetStoragePoolName "sof-pool"
    will return the following error: A parameter cannot be found that matches parameter name 'TargetVirtualDiskName'

    If there is any update or error I made please join the conversation an:
    https://social.technet.microsoft.com/Forums/windows/en-US/8de02e3f-41d0-42bc-b72d-9f1a785160c3/newvirtualdiskclone-not-working?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  ·  Documentation  ·  Flag idea as inappropriate…  ·  Admin →
  7. Set-DfsrConnectionSchedule doesn't change a replication partner of a group to use custom settings

    Set-DfsrConnectionSchedule doesn't change a replication partner of a group to use custom settings. I've even waited a day and it didn't change it.

    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  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  8. Windows Insider Build 18945 - Windows PowerShell is looking in One Drive for the PowerShell Profile

    I don't know why Windows PowerShell is looking for the PowerShell Profile.ps1 file in the Users OneDrive folder.

    This is not normal behavior!

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  9. PowerShell tabs

    Having the ability to open new PowerShell windows in tabs would be very useful.

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  10. Set-ADAccountPassword -WhatIf parameter does not work.

    WhatIf is apparently ignored on the Set-ADAccountPassword cmdlet. This bit me really good ********** yesterday and today. It's a big problem when we can't depend on WhatIf working.

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  11. Is anyone here aware of any tools that can help with automated naming conventions validation?

    Is anyone here aware of any tools that can help with automated naming conventions validation?

    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  ·  ISE and tooling  ·  Flag idea as inappropriate…  ·  Admin →
  12. Hi - I'm having trouble with the Wait-Job cmdlet on PowerShell Core for Linux. I have a Job created with Start-Job, which I wait for with:

    I'm having trouble with the Wait-Job cmdlet on PowerShell Core for Linux. I have a Job created with Start-Job, which I wait for with:

    Wait-Job $job -Timeout 30

    Which should timeout after 30-seconds. However, the command consistently hangs for 2-minutes before it completes. Am I doing something wrong, and if not, could this bug be fixed? I'm running PowerShell 6.2.0 on Ubuntu 16.04.6 LTS.

    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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  13. Bug: The first time New-NetLbfoTeam is used by Desired State Configuration it creates a misnamed interface

    The first time New-NetLbfoTeam is used by Desired State Configuration it creates a misnamed interface.

    This is on Server 2019 Build 17763.557 with the following updates applied:

    KB4483452
    KB4470788
    KB4503308
    KB4504369
    KB4503327

    Powershell shows:
    Name Value
    ---- -----
    PSVersion 5.1.17763.503
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.17763.503
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1

    For example:

    New-NetLbfoTeam -Name "Team1" -TeamMembers "NIC1" -TeamNicName "Team1" -LoadBalancingAlgorithm Dynamic -TeamingMode SwitchIndependent -Confirm:$False

    Will create an interface called "Ethernet" (Visible through Get-NetAdapter).

    If you delete the team and recreate in the same DSC, it'll work correctly.

    i.e. this works and creates an…

    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  ·  Desired State Configuration (DSC)  ·  Flag idea as inappropriate…  ·  Admin →
  14. Change the default for $ErrorActionReport to "stop"

    I'm kind of new to PowerShell, but I've been scripting with Bash, Perl, Python, etc... for years. Today, when writing a quick try/catch in Powershell, the catch would never run. After much searching, I came to learn that the default action in PowerShell is to ignore a catch with $ErrorActionReport = "Continue" (the default value). Is there a reason that the default is like that? I would think the vast majority of scripts using try/catch would want to actually run the catch, so why is the default "Continue" and not "stop"?

    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. BUG: Get-RDSessionCollection always generates exception on Windows Server 2019

    Get-RDSessionCollection of the RemoteDesktop module always throws an exception:
    --

    PS C:\windows\system32> Get-RDSessionCollection
    New-Object : Exception calling ".ctor" with "1" argument(s): "Invalid parameter "
    At C:\windows\system32\WindowsPowerShell\v1.0\Modules\RemoteDesktop\SessionDesktopCollection.psm1:520 char:14
    + ... $scope = New-Object System.Management.ManagementScope("\\" + $Conn ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

    CollectionName Size ResourceType CollectionType CollectionDescription
    -------------- ---- ------------ -------------- ---------------------
    mycollection 0 RemoteApp programs PooledUnmanaged My first collection

    PS C:\windows\system32>

    --

    Changing C:\Windows\System32\WindowsPowerShell\v1.0\Modules\RemoteDesktop\SessionDesktopCollection.psm1 line 520

    $scope = New-Object System.Management.ManagementScope("\\" + $ConnectionBroker + "\" + $wmiNamespace, $connectionOptions)

    into

    $msuri = "\\" + $ConnectionBroker + "\" + $wmiNamespace
    $scope = New-Object System.Management.ManagementScope($msuri, $connectionOptions)

    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  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  16. 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  ·  Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
  17. Cmdlet "New-Mailbox" cannot use -encoding UTF-8

    While the UI for ExchangeOnline and Office365 can use UTF-8 when creating new resources, the Powershell cmdlet cannot.

    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  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  18. Remote Invoke-Command with -ScriptBlock changes types of arguments if scripblock contains variables

    What's going on here???

    PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Write-Host hi} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name}
    ScriptBlock
    PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Write-Host hi} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name; $a=3}
    String
    PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Get-ChildItem} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name}
    ScriptBlock
    PS C:\> Invoke-Command -ComputerName somemachine -Credential $cred -ArgumentList {Get-ChildItem} -ScriptBlock {param($sb); Write-Host $sb.GetType().Name; $a=3}
    String

    2 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 →
  19. Bug: Write-Output -InputObject (,'Test') -NoEnumerate

    The `-NoEnumerate` switch doesn't work when when the input is named using the `-InputObject` argument in PowerShell version 5.1.

    The following script returns `False`:

    Function Test {Write-Output -InputObject (,'Test') -NoEnumerate}
    (Test) -is [Array]

    While this script returns `True`:

    Function Test {Write-Output (,'Test') -NoEnumerate}
    (Test) -is [Array]

    $PSVersionTable

    Name Value
    ---- -----
    PSVersion 5.1.17134.858
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.17134.858
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1

    This issue doesn't appear with PowerShell Core 6.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  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  20. Extraneous results returned with Resolve-DnsName (dnsclient)

    Quoted feedback from documentation feedback provided by MSFT team below. (via @jordanmills)

    > When resolving SRV records (example: Resolve-DnsName -Name "_kerberos._tcp.dc._msdcs.$env:userdnsdomain" -Type SRV), the cmdlets also attempts to resolve any returned A or AAAA records and sends them to the pipeline as a separate object collection. This breaks pretty much any attempt to sort, group, filter, or otherwise process the data. How can we make it not return A and AAAA records for SRV queries?

    https://github.com/MicrosoftDocs/windows-powershell-docs/issues/302

    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  ·  Microsoft.PowerShell.* Modules  ·  Flag idea as inappropriate…  ·  Admin →
  • Don't see your idea?

Feedback and Knowledge Base