# 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.
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 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

2. ## Memory leaks while using powershell runspace in .NET

I found a huge memory leak in project which appears after execution PS command. Here I create example that represent my problem in "TestCase" comment.

After memory usage investigation I found that most of memory occupied by inner structures from System.Management.Automation. So I start to search the way to release resources and found that the same behavior can be reproduced in PS:
Get-Module -ListAvailable | ForEach { Import-Module $_.Name } Get-Command -ListImported -CommandType Cmdlet,Alias I already have tried to initiated garbage collecting and to remove all new variables that appears after script execution. I even have tried to start new… 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 3. ## BUG: sort in pipeline don't work correctly Hi When you use the sort function in a pipeline it will work in ISE but not when you run the script direktly (see attached logs). By run it dierktly it sorts the objects wrong. Greetings from Germany 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 4. ## SEHException I can't use power shell. If I open it, print these error ハンドルされていない例外: System.Runtime.InteropServices.SEHException: 外部コンポーネントが例外をスローしました。 場所 System.Reflection.RuntimeAssembly.GetResource(RuntimeAssembly assembly, String resourceName, UInt64& length, StackCrawlMarkHandle stackMark, Boolean skipSecurityCheck) 場所 System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck) 場所 System.Resources.ManifestBasedResourceGroveler.GetManifestResourceStream(RuntimeAssembly satellite, String fileName, StackCrawlMark& stackMark) 場所 System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark) 場所 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark) 場所 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) 場所 System.Resources.ResourceManager.GetString(String name, CultureInfo culture) 場所 System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream) 場所 System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) 場所 System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper() 場所 System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc() 場所 System.Management.Automation.Runspaces.PipelineThread.WorkerProc() 場所 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 場所 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state,… 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 5. ## Start-Job on Windows Server 2016 hangs Powershell Start-Job seems to sometimes cause the calling thread to hang. If you create a loop in ISE and spin off a bunch of jobs, inevitably it will hang. This has only been tested using a ScriptBlock. As a workaround, you can use threads to do the heavy lifting and so if they fail to start the job, just recreate the thread. 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 6. ## Powershell Pipe is not respecting the AllParameterSets value . Repro: using the following script: function Test { [CmdletBinding()] Param( [string]$name,

[Parameter(Mandatory = $True, ParameterSetName = "Set1")] [Parameter(Mandatory =$True, ParameterSetName = "Set2")]
[string] $P1, [Parameter(Mandatory =$True, ParameterSetName = "Set2")]
[string] $P2 ) Write-Output ($name + " - " + $PsCmdlet.ParameterSetName) } #The following Fails! e.g. Powershell doesn't resolve to ParameterSet "Set1" 'aaa' | Test -P1 x 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 7. ## profile.ps1 doesnt load when Windows Powershell 2.0 engine was disabled. We have been using automation script for our deployment. We are using the latest version of System.Management.Automation. System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 We have few modules referred in profile.ps1 which automatically loads when we execute the ps1 files. This works fine if we have enabled Windows Powershell 2.0 engine. If we disable Windows Powershell 2.0 Engine this doesnt load the profile.ps1 in$pshome and scripts throws functions not found error.

This seems to be weird behavior as all our scripts still works with Powershell 5.1

Would need your attention to help fixing this or provide a solution to fix this.

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

8. ## Filesystem PSProvider Doesn't Handle Folder with Trailing Space

*-Item -Path "$home\try \it.txt" fails, even if "$home\try " exists. Note trailing space character after folder name.

This has been observed for New-Item (using -Force), Get-Item, Get-ChildItem.

This is on Windows 10 Enterprise versions

PSH: 5.1.17763.592 + Winver: 1809 build 17763.678

PSH: 5.1.18362.145 + Winver: 1903 build 18362.295

(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

9. ## New request -- get-winevent :get all log generated by a specific user

If I try to find when the user abc.cd logon to my computer.
I will do a log query as follow.
Get-WinEvent -FilterHashtable @{logname='security';data='abc.cd';id=4624}

If I want to know when a software was install on computer.
I will do a log query as follow.
Get-WinEvent -FilterHashtable @{logname='application';id=11707}

but It does not work with a user ID as follow.
Get-WinEvent -FilterHashtable @{logname='application';id=11707;data='abc.cd'}

What I do I want is collectting all logs that caused by the user abc.cd by using get-winevent , like he installs a new software , he starts a service ,he starts a scheduled task ..

expected cmdlet:
Get-WinEvent…

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

10. ## Allow use of curly braces for special cases

Such as git stash apply stash@{2} instead of need for inside quotes "" "stash@{2}"

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

11. ## 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
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

12. ## 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
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

13. ## Bug: Get-Random doesn't return Maximum value.

setting a maximum value for get-random doesn't return the maximum value.
$I=@{1=0;2=0} for ($q=1;$q -le 10000;$q++) {
$VAL=Get-Random -Minimum 1 -Maximum 2$I[$VAL]++ }$I

Name Value
---- -----
2 0
1 10000

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

14. ## Hhhmmmmm ...

Sounds good to me!

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

15. ## FeatureRequest: Have New-PSdrive store credentials in Credential Manager when Persist and Credential options used

Currently there is no built in or easy way to have credentials stored to map persistent Drives via a script.

If you are mapping a drive for the same domain that the system is on then it will pass-through the current user's credentials, and it will save alternate credentials for the mapping in the current user session. However if you are trying to map a persistent drive for a share from a different non-federated domain, a workgroup computer, or for something on the same domain using different credentials, the password is not saved through logouts or reboots. Not only is…

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

16. ## 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
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

17. ## New-NetIPAddress Prefixlength not working

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

1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

18. ## 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 19. ## 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 20. ## Pressing spacebar while holding shift should still insert a space Pressing spacebar while holding shift should still insert a space. When I am typing into the PowerShell prompt, if I happen to be holding down the shift key when I hit the spacebar, nothing happens. I would like for a space to be inserted when I hit the spacebar, regardless of whether I am holding the shift key or not. (The classic Command Prompt does this correctly.) For reference, I'm using Win10 1809 and: PS C:\>$PSVersionTable

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

(thinking…)