# 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. ## 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 2. ## 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 3. ## XXXUDPORACLEANORDIQUEBEASTARAPTORONTOCLOCKIRKLANDROSOPHITLEROMARSATUROVIRG0ALUDPOPEYELLEFTWINGAYARDLINEART©P/IP143&144MASMENDREDICCMELEDFER J'OFFRAMANOVOIDATAPIGUTAGRAISSEALIMENTORONTOCOLLORACLEFLAG0ADACHAUTEARTIGAYOURSELFERLANDOMARSAMPLEADERSSQLITORISHTARROWHADOWASPDEAUQIONCHINM 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 4. ## 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 2 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 5. ## 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 6. ## 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, Dictionary2 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 7. ## Serious MASSIVE BUG: Mount-DiskImage not scriptable Hi Mounting a ISO image is happening via Mount-DiskImage -ImagePath C:\ISO\isofile.iso -PassThru. This is working. BUT: the -ImagePath parameter doesn´t accept any(!) variables. This makes it absolute and total unusable in a script because usually the Path to a iso isn´t always static. If I have an static Path i can use the explorer. Its faster and easier. Dissapointing 3 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 8. ## "Using module" statement does not reload module after changes are made Problem Description ------------------ If you are using the using module statement, it will load the module without any issues. However, if you make a change to the module and run the using module statement again without restarting your PowerShell session, it will not load the new modified module into memory, and instead will continue to use the old existing module that was loaded. This makes doing development with using module statements very tedious as you must continually reload your PowerShell session whenever you make changes to the module. Ideally we would just use Import-Module -Name [module name] -Force` to avoid… 35 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 9. ## 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 10. ## 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

11. ## 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 3 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 12. ## 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 Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 13. ## 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 Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 14. ## 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 15. ## 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.

(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

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

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

(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

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

19. ## Hhhmmmmm ...

Sounds good to me!

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

We’ll send you updates on this idea

20. ## 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…)