r/PowerShell • • Aug 31 '19

Question I've picked up a virus/malware?

Whenever I launch powershell in Windows 10, I now get a message on screen that says:

"Try the new cross-platform PowerShell (https://)aka.ms/pscore6" - (parentheses added so that the link is not live)

As I am suspicious that powershell as a whole has been compromised, how can I download and replace powershell.exe with a valid version?

0 Upvotes

15 comments sorted by

8

u/MadsKejser Aug 31 '19

A New version of PowerShell have been released.

It is just an advertisement to make people switch.. :).

1

u/stefanw1337 13d ago

It's funny, after 7 years this still comes up. You would think with a "feature" like Windows Update, that they would have made it through there.. They made the advertisement, so you'd think they wanted people to update.. So if not as an option, make it a forced update so it doesn't NAG for 7 years, lol. Advertisements in my OS, gimme a break!

4

u/PSFred Aug 31 '19

Hi CV,

this is by design! The Windows PowerShell you know about (powershell.exe) has stayed pretty much the same since Windows 10, right? Well ... there's a reason for that: They stopped developing it!

Instead, the PowerShell Team moved on to build PowerShell Core, which no longer builds on the .NET Framework and instead uses .NET Core, making it cross-platform. You can install it on Windows too, and benefit from the new features (that link will lead you straight to where you can get it).

Changing to PowerShell Core (pwsh.exe) is not a permanent thing - you can have both available at the same time and use whatever you like or need to use. What's new on the new version? Too many things to list here, but to name a few highlights:

  • It's faster

  • Better web cmdlets

  • It's faster

  • New language elements making powershell even more convenient

  • It's faster

  • SSH-Based remoting

  • It's faster

"Now what's the downside, why not automatically include it and replace the old one?" you may wonder. Well, there are some downsides:

  • Breaking change on WMI commands (no Get-WmiObject, but you should have used Get-CimInstance for a long time now anyway)

  • Breaking change on DCOM/RPC remoting (many commands that used to have a -ComputerName parameter no longer have it. Use Invoke-Command instead.)

  • Not all modules that run on Windows PowerShell run on PowerShell core (But it's gotten a lot better!)

  • No GUI elements such as Forms (Coming back on Windows in the next major version. Already available in preview)

Now why show the message now? Well, most admins don't track new developments unless they stumble over them. This is MS making you stumble over it, so you question it and consider taking a look. Why now and not earlier? Well ... by now we have almost feature parity and a lot more modules are available on core.
When exactly to make it very public was a bit of a judgement call, but now is definitely a good time to take a look.

Cheers,
Fred

4

u/milennium972 Aug 31 '19

Maybe I misunderstood but it s seems faster.

1

u/HOTTUBBACON Sep 01 '19

(https://)aka.ms/pscore6

But is it faster?

1

u/jantari Sep 01 '19

You are absolutely nowhere near feature parity and the fact that this advertisement cannot be disabled is insulting.

You don't need to convince anyone to switch, as soon as you actually have feature parity you just drop in replace PoSh 5.1 with PoSh 7 via Windows Update. Easy.

It is inexcusable to introduce advertisements to the CLI and you know it

1

u/PSFred Sep 01 '19

Unfortunately, I know no such thing :(

Replacing one pointless starting message with another pointless starting message by itself would not change anything for me, so yes, I am very far away from terms such as inexcusable.

As for "cannot disable" ... that's what the -NoLogo exists for. You can create a custom shortcut with the same logo and the parameter included.

We can never fully replace Windows PowerShell with PowerShell Core, as there are breaking changes (and most of them I'd argue are for the good. I am quite happy with all the unsafe legacy stuff we lost - all that DCOM/RPC based remoting is rather ugly).

That said, it will start shipping as an optional Windows 10 feature in some future upgrade and then later on be installed by default as the default shell. That move - especially the last one - is obviously not in the imminent future, for the very reason that it has not yet managed to span all the features admins really need. Like the GUI stuff (including Out-GridView) they are currently working on in the preview version.

We are stuck with some things not working anymore on the core version though. Get-WmiObject is not coming back (not sorry). So now that it is far enough long to have the broad masses take a look - just what is "far enough" obviously is subject to interpretation and you appear to disagree - so that just maybe a few people less write code that cannot run on the new platform, when there is no technical need for them to do so.

Bottom line: The more people try it, the better it will become and the less impact switching over will have for an organization. Disable the message if you dislike it. Switch over or stay with the current version, whatever you prefer (and Windows PowerShell isn't going anywhere - 5.1 will be available for a looong time. We still have cscript and cmd as well).

Cheers,
Fred

2

u/jantari Sep 01 '19

I am aware of -NoLogo, unfortunately though you keep replacing the PowerShell shortcuts inside the start menu directory, which are the ones being called from the Win + X menu, on every new feature update with the stock shortcut files.

So I apply my color scheme, add -NoLogo and then when version 1909 rolls around it's all gone again and I'm back to seeing ugly dark blue backgrounds and advertisements on startup.

Of course one way would be to get rid of your default shortcut again by running a custom script after every feature update (setupcomplete.cmd), but unfortunately this functionality is reserved for installations of Windows 10 using a volume license activation so I cannot even utilize this basic feature at home - despite running the "Pro" SKU.

So you see there is in fact no permanent way to dsiable this. I did look into it before becoming pissed, don't worry.

As for PowerShell 7+ I am aware of the release plan, it has already been publicly announced. Breaking changes don't mean you can't ever drop-in-replace it though. Windows has always introduced breaking changes on version updates and so have other programming languages - some intentional, some not. The reason we still have cmd and cscript is because they're still being used. Why are they still being used? Because PowerShell was never an adequate replacement for them, it is FAR too slow and cannot be started entirely hidden like vbscript can. The -WindowStyle Hidden parameter has been bugged since the dawn of time and still shows the conhost window for a while before then hiding it.

If PowerShell 7+ is finally adequately fast and bug-free you are in a position to do what Apple did and finally get rid of all the outdated scripting languages in your default OS install to standardize on one.

I have nothing against PowerShell 7+, but I am going to start using it when it is ready (near feature-parity) and not when you advertise it to me. Nobody cares about Get-WmiObject because the only operating systems that require it / don't have the CIM-cmdlets are out of support in a few short months anyway. Is it going to break existing, bad scripts? Yes. Is that to be expected according to Semver 2.0 notation going from PowerShell 5.1 to 7.0+? Also yes, so no biggie - everyone is aware. Admins are also used to the notion of having to prepare updates and features for upcoming Microsoft changes (Office365 discontinuation of TLS1.0, Windows Update signing changing to SHA2 just two very recent examples).

1

u/PSFred Sep 01 '19

Regarding the logo thing: Then you'd just need to change the way you call it is what I'd like to say (there are persistent alternatives after all) ... but I get your point: You don't want the new logo even for a minimal moment (cls in profile would remove it rather swiftly) without having to change your current ways.

I'd call that tough luck, but from your point of view, dissatisfaction is understandable.

Re: Color scheme; You could define it in your powershell profile, those survive feature upgrade.

Regarding old script engines: You pretty much nailed it. They are still being used. Same will happen for windows powershell, because people won't want to fix bad code. Not surprised, not worrying about it.

As a curiosity, as you keep bring it up: What would constitute near feature parity for you? Are there any hard requirements you can name? Just curious, because I cannot honestly see how the v7 preview doesn't qualify, so I'm wondering just what your criteria are.

2

u/jantari Sep 01 '19

Regarding the logo thing: Then you'd just need to change the way you call it is what I'd like to say (there are persistent alternatives after all) ...

No. User preferences being reset upon updates is a bug, it is not on the user to change their behaviour. Also, I use Win + X because it is the fastest and easiest way to get to PowerShell. I'm not about to compromise on productivity by going some slow route. Clear-Host in the profile will run delayed, the Logo message is displayed before the profile runs and because PowerShell is PowerShell there is sometimes a multi-second delay between the Logo message appearing and the shell being ready for input. And no, it's not my 5 line profile causing that. It's just sometimes slower than other times, as I'm sure you've noticed as well.

Re: Color scheme; You could define it in your powershell profile, those survive feature upgrade.

No. That is not ideal because the settings already in HKCU:\Console apply to all conhost windows, most importantly cmd and powershell. My PowerShell profile would only affect PowerShell, thus I would lose the ability to define a uniform color scheme in one place. It is also easier to programmatically set the registry values than to regex a profile script to programmatically change the theme. I could design a JSON/INI/TEXT format to hold the scheme and load that from a seperate file via a function in my profile - but why should I have to make it so complicated when there is already an easy standardized way to store the theme in the registry that exists and works on all Windows computers?

The reason this is such a big concern to me is because I created and use a script I called poshwal to set my terminal theme. It's simple and effective would it not be for the shortcut-reset bug.

As for the PowerShell 7 feature parity, you already know the answer: Microsofts first-party modules and or SnapIns need to be fully supported. Whether they be updated, rebuilt or PowerShell 7 includes a shim of sorts to be able to load the old versions unmodified but Exchange, AD, Remote Desktop, IIS, SharePoint, Workfolders etc etc. all need to be manageable from PoSh 7+. Also, it's still not fast enough really. Basic math (find primes, solve Pi ...) still takes longer than Python despite both languages sharing characteristics such as being interpreted and dynamically typed. This isn't as big a deal though and I'm very thankful for the decrease in ridiculous slowness we've already gotten from PowerShell 6+.

1

u/PSFred Sep 01 '19

Well ... regarding the customization options, we'll just have to agree to disagree in how we interpret impact, relevance and thus viability of options. Suffice to say that while I disagree, your argument is coherent and I can accept that and why you feel dissatisfied.

As for the PowerShell 7 feature parity, you already know the answer

Actually, as it turns out, our priorities for what constitutes near parity appears to be slightly different (which is cool, I asked for your version after all :) ). Near parity for me was the missing GUI support and the majority of the built-in stuff (notably, the until 1903 missing support for Active Directory was a major no as far as I am concerned). TBH, I don't even know which one of the first party modules would still be missing. Maybe SCCM? Any one you have on your radar that still won't run on PSCore and also won't run under the Windows Compatibility Module?

1

u/jantari Sep 18 '19

Sorry for taking so long to get back to this.

I've been using PowerShell 7 at work for the past two weeks, and it's much more compatible than I had thought.

When PowerShell 7 was announced I read about the Windows compatibility pack and that it adds some platform specific APIs back, but the talk was all about WinForms and WPF really - which are completely irrelevant to my use of PowerShell.

So what I didn't know was that we also got some APIs like System.Drawing.Colorthat I have no idea why they were ever missing from PS Core in the first place - that's great.

What I especially didn't know was that the legacy PowerShell SnapIn-technology was supported again. It was sunset so long ago in favor of modules.

Anyway, this makes PowerShell 7 usable on Windows computers. In fact, it's better to use than 5.1 right now I'd say.

It still needs to be much faster to start up though, I just cannot fathom how I have to wait what amounts to actual seconds for a command line to load. Maybe with PowerShell 8 ...

2

u/SeeminglyScience Sep 02 '19

Regarding the logo thing: Then you'd just need to change the way you call it is what I'd like to say (there are persistent alternatives after all) ... but I get your point: You don't want the new logo even for a minimal moment (cls in profile would remove it rather swiftly) without having to change your current ways.

To be fair, cls in profile kinda sucks when nesting PowerShell instances. I still do it but 🤷‍♂️

1

u/FirstZodiac Oct 29 '19

I would use such strong words, but I agree. I don't or want to see this every time I open a cli. We are running PRD machines we will switch when the benifits are obvious.

1

u/[deleted] Aug 31 '19 edited Aug 31 '19

Nah. I've seen that message too. It's legit.

aka dot ms is Microsoft's link shortening service like Bit dot ly