PowerShell/PowerShell-RFC

Q&A for PowerShell Community Call for Nov 21, 2019

joeyaiello opened this issue ยท 66 comments

Please post all questions and comments in this thread for today's community call

I can hear and see the stream at least ๐Ÿ˜‚

Woo!

Will Jim's Linux file/dir Get-ChildItem display changes make it into preview.6?

yeah, what's in p6?

Would love to see either read-host -maskinput or ConvertFrom-SecureString -AsPlainText make it into v7. Having to do [pscredential]::new('jpgr', $ss).GetNetworkCredentials().Password is getting really old. :-)

I would love to have this little one in p6 / v7 ๐Ÿ˜‰ PowerShell/PowerShell#11097

Also if we could get PowerShell/PowerShell#11032 in for v7 at least.... that'd be swell. I've had so much pain working with native DLLs ๐Ÿ˜ญ

Agreed on being risk-averse. PS7 needs to make a good first impression to try to get more of the WinPS5 folks to move over to 7.

Maybe talk to Tobias about a place to save the videos. He owns http://Powershell.video domain ;)

So in the Old days, when IE used to be useful, we could use
$ie = New-Object -com internetexplorer.application; $ie.visible = $true; $ie.document.getElementsByName

to like automate UI testing for the web in a stable manner, like grabbing and clicking a button, searching for text

with the new Edge being worked on, are we hopefully getting something that works on chromium based browsers or..at least Edge?

I really miss that....

what plugin is Joey using for darkmode on github?

@ziabytes I can't speak to anything natively available in PS but Selenium might be worth a look for you. ๐Ÿ™‚

The biggest gap in the world is always the gap between knowing and doing. ๐Ÿ˜‰ ๐Ÿ˜‚

Did y'all get the issues with PSRL on Unix systems fixed up for the preview extension?

Do love the new LSP stuff we got in, it really does make a world of difference. ๐Ÿ™‚

@vexx32 I know, I can and do use selenium, but there are way too many scenarios, where the only option you have is to run a powershell script to do something, and want something light, that then sends the data somewhere else..like for monitoring...

@ziabytes for selenium, take a look at
https://github.com/adamdriscoll/selenium-powershell
I believe it works with multiple browsers!
Cc @adamdriscoll

We discussed on Twitter today a potential future (but also big) feature idea, which would be to compile PowerShell script code to a binary for faster execution and import time (as parsing and compiling gets skipped). Basically kinda like crossgen/ngen but for PowerShell
https://twitter.com/CBergmeister/status/1197430391264571392
What are the thoughts of the team on that, Jason said he already did a PoC once. Would there be an interest for the team for that investment?

@ziabytes It does support multiple browsers. IE, Chrome, Firefox, Headless Chrome etc. It's also cross platform and works on PS6\7.

Did y'all get the issues with PSRL on Unix systems fixed up for the preview extension?

@vexx32

PS7 (well .NET Core 3.0 really) fixed most of the issues.

That's the main reason we're waiting on PowerShell 7's release.

PSRL will be ON for PS7 for unix.
If you use PS6 on unix with the Preview extension, we give you the legacy readline (you can turn it on, but it's not recommended).

Another thing to consider is that PS imports modules faster if there are fewer PS1 files to parse. So folks write build scripts to mush multiple (easier to maintain) PS1 files into the module's PSM1 file for perf reasons. That points to a dot sourcing perf problem. How can we make this better without having to resort to such hacks? AOT compilation is one solution but maybe there are other ways? Maybe a module cache (managed by PS) that has the combined scripts (comment stripped, etc) in a single, quicker to load file?

Are binaries that work on all machines regardless of OS and PS installed or not...a completely different or out of scope than what @bergmeister talked about?

@rkeithhill I suspect that will not be feasible to improve until the PSD1 or Import-Module (perhaps) supports automatically importing PS1 function files that are named in the manifest without having to go through the PSM1.

That way perhaps we can avoid the perf impact of dot sourcing from the PSM1.

I was looking at tweaking Where-Object recently and... man that parameter binder is a thing to wrestle with ๐Ÿ˜‚

Random aside, what spell checker are you using in Code? It looks like it works a lot better than the one I have.

@rkeithhill it's interesting because that "mushing" is what the web world does today with things like webpack - which give the app developer the opportunity to write nice looking code that turns into mush on deployment.

@Windos Code Spell Checker by Street Side Software

@TylerLeonhardt Good comparison. But the web world is also looking at WebAssembly....

What's the deal with "experimental" features -- are those going to stay experimental in PS7 GA?

Probably a case by case basis I'd think? ๐Ÿค”

Tbh I've yet to see an experimental feature that I haven't liked so ๐Ÿคทโ€โ™‚

Nice work, Jim!

@bergmeister yep that's an alternative not a replacement. Gonna have to wait for .NET 5 for any PowerShell on WebAssembly possibilities ;)

LOL. I don't even have them all turned on, and I have problems with some. Do we have any concept of whether people are using them if they're not on by default in the betas?

@TylerLeonhardt RE webpack and mushing, that is why I wondering if there was more than one way to address the issue. psmpack? :-)

Oh right I still wanted to get suggestions decoupled from the host.... I may need to dig up that PR so we can (hopefully) get it going for PS7.1 or something...

But none of the experimental features are on by default, even in preview (right? I mean, that seems to be the case in my experience)

They are all on by default unless you've an existing config before installing the new preview, I think?

It's on by default if you've never enabled any of them them previously. So if you were enabling them before they were on by default, then nothing would have been turned on.

Sort of like the shell discovery in Terminal, it only worked if you hadn't defined any of your own ๐Ÿ˜’

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

Yeah they probably should be on-by-default unless you have a specific setting to disable them (in the previews, anyway). Might require some updates to how that's determined.

holy crap thats amazin

need this for Windows

Yeah, that completer module looks to be a must-have!

I may have missed it in the discussion, but is there a plan for when the current experimental features will graduate to mainline features?

If only Windows had a shell with completers that dev tools could accomodate ...

On Windows, if you do web work, you want to have the NPMTabCompletion module (by @dfinke).

@Windos there's no one plan, and no details about any specific experimental features

Or use posh-cli, a meta module, which discovers and bootstraps all your required CLI completers modules for PowerShell:
https://github.com/bergmeister/posh-cli

If only Windows had a shell with completers that dev tools could accomodate ...

If only everything had a PS module...

If only Windows had a shell with completers that dev tools could accomodate ...

If only everything had a PS module...

If only people stopped writing console apps (CLIs), the only console app that is needed on this planet is dotnet new console pwsh ๐Ÿ˜‚

If only Windows had a shell with completers that dev tools could accomodate ...

If only everything had a PS module...

https://www.powershellgallery.com/packages/PSEverything/3.2.1
๐Ÿ˜

Y'all just need someone coming in and transcribing answers ๐Ÿ˜‰

Can't we just have the json be a key/value with true/false for explicit "enable/disable" for experimental features?

Time to revamp the settings.json. ๐Ÿ˜‰

In ps7 there is new error trapping logic where it will show the actual line the error occurred on. A lot of the time in PS I just do the below. Is there anyway to capture the new error messaging including line numbers into a var that could then be emailed or texted?
try{
#stop on error action to fall into trap
}catch{
$errorm = $_.Exception.Message
#send email with error message
}

@strunker you can try $_ | Out-String to get the error formatted to string with all the usual info?

Question: I had an issue with being able to pipe stdin into an external binary last week and it seems there are still some features where PowerShell lacks behind bash (in this example the equivalent of the << operator). Is the team aware of things like that? I commented on an existing issue, will probably open a separate one later.

Any news on when the Secrets Module @SydneyhSmith showed at Ignite will be released?

Just on the Windows cli tool completions, @lzybkr has a great module for this: TabExpansionPlusPlus.

That comes with a number of included completers for Windows utils and cmdlets, and adds a quite nice DSL for adding your own.

@dmbrown1386 We are hoping to have a public preview out for the Secrets Management module by the end of this month but with the holidays/vacations quickly approaching it will more likely be early December

On the PSUnixUtilCompleters module:

  • If you look at the code, you'll see that it's pretty small; it's just intended to leverage the completers already there in POSIX shells
  • The bash completion "API" is a little tricky, but it is at least an API
  • Whereas zsh often provides better completions, but doesn't have an API (the module uses a script that does some scraping hackery)
  • By default the module prefers zsh if it can find it, but there are more edge cases because of the scraping. So if you find any, please open an issue
  • You can also configure the module to point to a zsh or bash of your choice
  • Currently there's no way to disable the module once it's loaded, or deregister a command where it's flaky. Again, please open an issue if you have a specific desire around what that should look like
  • Eventually this module's repo will be moved to a federated utility module repo, so the PS Gallery is the best place to get releases

Just on the Windows cli tool completions, @lzybkr has a great module for this: TabExpansionPlusPlus.

That comes with a number of included completers for Windows utils and cmdlets, and adds a quite nice DSL for adding your own.

well from the comment here TabExpansionPlusPlus seems dead and non-functional for PowerShell Core 6 and later versions.
Did I get this wrong?

For those asking about my Ignite demos, I uploaded them here: https://gist.github.com/joeyaiello/c4ed8b6e623d420c96ea07706f25214c

Also closing the issue given the call is over. Will be linking to here from the community call README once I get it uploaded.