# 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. ## PowerShell Crash Get-NetFirewallProfile when run as service

PowerShell crashes when running "Get-NetFirewallProfile | Select-Object LogFileName" by a windows service. In my case it was check_mk through a monitoring plugin.

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

We’ll send you updates on this idea

2. ## Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed

We are experiencing about 12 minutes wait time to start Powershell session because of disconnected network drive that didn't get clean up properly. It would be helpful for PowerShell to support ignoring drive or allow for timeout setting so we don't have to wait that long.

C:\Users\keatchan>time /t & powershell get-date
09:07 PM
Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.

Wednesday, October 18, 2017 9:19:05 PM

(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

3. ## using module <Module> does not work as expected

Script is just two lines as following:

(I tried the respective registry entry and "$ie = new-object -Com InternetExplorer.ApplicationMedium", no better.) (This input box is too small.) After some script statements to log in and navigate to the incoming tickets monitor, I do a$newcalls = $ie.Document.getElementsByName("callid") (This input box is too small.) That's working perfectly fine in PowerShell version 4, but in v5 I get Exception from HRESULT: 0x800A138A At <path>.ps1:89 char:5 +$newcalls = $ie.Document.getElementsByName("callid") + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 9. ## Catch illegal syntax in array definition Today I had an issue where getting an element at a certain index in a typed array failed. As I was troubleshooting this issue I found that it was simply because I had used a '.' (dot) instead of a ',' (comma) to separate the elements when I defined the typed array variable. Okay, that is a clear mistake on my part. However, as I thought about it I would have loved to be alerted by the Powershell engine . -- Experienced on v5.1.14409.1012 of PowerShell -- Win7 x64 OS  TO REPRODUCE: open vscode create ps1 file$array = &quot;hej&quot;,
1 vote
(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

10. ## [BUG] Drag and drop to scripts shortcuts split paths containing spaces

Drag and dropping any file to a script shortcut split this path before passing the splitted strings as multiple parameters. Here's my detailed Issue Report :

## Steps to reproduce

1 - Get any script, for example :
[samplescript.psd1] :

param([string]$path)  Write-Host($path)
pause


 or a simpler one-line sample:Write-Host($args);pause 2 - Create a shortcut that runs the script : [Shortcut Target ] : PowerShell &quot;path\to\our\samplescript.psd1&quot; 3- Drag and drop a file containing spaces in its name to the shortcut [sample file ] : C:\Some file with spaces.txt ## Expected behavior Drag and dropping the file should pass its path to the… 4 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 11. ## Can you add some stuff to Get-ClipBoard? I would have liked the default behaviour to be that an array of newline-split strings was returned from Get-ClipBoard. 97 % of the time I end up writing (Get-ClipBoard) -split "\r?\n" | ...... often filtering out empty elements - and that's just boring. In my own version I used -Raw for a string and nothing for an array/list. Of course you can't change that now in the 5.x version (or later, sigh, will this be our doom in some distant future), but can you maybe add at least -AsArray or similar? Make it so it can only be used with… 3 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 12. ## Fix .NET date formatting bug in .ToString() PS D:&gt; gcim win32_operatingsystem | % caption Microsoft Windows Server 2016 Standard PS D:&gt;$PSVersionTable.PSVersion

Major Minor Build Revision

5 1 14393 1358

PS D:&gt; [DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss')
2017-07-27 12.29.37

(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

13. ## Remote Powershell Session "-ErrorAction Stop" give Non-Terminating Error

Script with Remote Powershell that are using Try/Catch and (of course) Terminating error, but for some reason under PSv5.1 Shell now those "-ErrorAction Stop" aren’t producing Terminating Error.

I need to force $ErrorActionPreference = “Stop” to have my Try/Catch to work. 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 14. ## Powershell does not interpret set variables Powershell has (optionally) replaced cmd as a standard shell in Windows 10. However it is a pity that Powershell is not able to interpret commands that rely on usage of variables that are defined in "set" like %computername%, %windir%, %userprofile%, %appdata% etc etc Please respect your own system variables in use for decades Microsoft. Thank you a lot. There must be way without breaking this. try issuing a simple cd %appdata% in powershell (often used in KB articles), good luck and have fun (or not). Imho while I could understand limitations this is pretty odd. 3 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 15. ## Command line parsing bug: spaces and trailing slash There appears to be a bug parsing arguments to EXEs. If you pass a properly-quoted path that has spaces and a trailing slash, the rest of the command is lumped into the same argument. This also happens if you use a PowerShell variable to hold the path string. To repro, first, install EchoArgs.exe (if using chocolatey: cinst -y echoargs). It demonstrates what arguments would get passed to any exe. Then run: PS> & EchoArgs "C:\spaces and trailing slash&quot; more args Echo args shows that it all got lumped into one argument: Arg 0 is <C:\spaces and trailing slash" more args> 6 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 16. ## Make the Continue statement work in ForEach-Object Within in ForEach-Object script block, "continue" behaves like "break", and one should use "return" to simulate "continue". But, from my perspective, it would make sense to give "continue" foreach-object awareness 3 votes Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 17. ## Bug: New-PSDrive mounts locally scoped, even though it is supposed to be across a powershell Session. Confirmed that PSDrive is only scope locally in the class method is was called in: Test Setup: Mount(): HKU, HKCC, HKCUHKLM in class method. Display PSDrive mounts. Call Test() within that Mount(), which mounts HKCR; Display PSDrive in method call. Display PSDrive mounts on Test() return Display PSDrive mounts on Mount() return Call Test() method from main, Display PSDrive mounts. Display PSDrive mounts on Test() return VERBOSE: Mounting registry drives for use ... VERBOSE: HKU VERBOSE: HKCC VERBOSE: HKCU VERBOSE: HKLM Alias C Cert Env Function HKCC HKCU HKLM HKU Variable WSMan (Scope: Mount()) Alias C Cert Env Function HKCC… 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 18. ## Slow "." hash lookups Slow "." hash lookups (more than 100 times slower than []) from PowerShell Version 2 to Version 5.1 This could be either a documentation problem or a bug. The documentation never says that the "." hash lookup can be much slower than the [] lookup. I hope it is a bug (one less thing to remember). They both worked at the same speed in PS Version 2.0 and diverged sometime after that. Two script files. The first calls the second forcing versions 1 thru 5 of PowerShell. The "." hash lookups in PS Version 2.0 take .028 seconds. The "."… 1 vote Sign in (thinking…) Sign in with: Facebook Google Signed in as (Sign out) We’ll send you updates on this idea 19. ## Provide a native ternary operator It would be very nice and convenient if PowerShell had a native ternary operator like C# does (https://msdn.microsoft.com/en-us/library/zakwfxx4(v=vs.100).aspx). Basically it would allow you to write a short-hand if-else statement, so instead of having to write: if ($someBoolCondition)
{

$x =$y.Property1


}
else
{

$x =$y.Property2


}

you could just write:

$x =$someBoolCondition ? $y.Property1 :$y.Property2

This operator is fairly standard in many programming languages, so it would be awesome if PowerShell could come up to speed with it as well. Thanks.

(thinking…)
Signed in as (Sign out)

We’ll send you updates on this idea

20. ## Do not require starting brace to be on same line as cmdlet

It is very annoying and confusing that some cmdlets require the starting brace to be on the same line as the cmdlet, while others do not.

For example, this is valid:

... | ForEach-Object {

$sourcefile =$_.Name


}

but this is not:

... | ForEach-Object
{

$sourcefile =$_.Name


}

yet using this is valid:

foreach ($x in$y)
{

$sourcefile =$_.Name


}

I know that you can use the backtick to make it valid, like this:

... | ForEach-Object 
{

$sourcefile =$_.Name
`

}

but that's still not intuitive and requires you to remember to do…

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

We’ll send you updates on this idea