So let me jump into Windows and show you how easy it
really is to install PowerShell 7.
All right,
so I'm on my Windows 10 desktop and I've opened up a
Windows PowerShell 5.1 session,
and we can verify that by looking at the $PSversiontable variable.
So, yes, I am running Windows PowerShell.
Now before we get to installing PowerShell 7,
let's go to the GitHub repo, and I'll do this here from PowerShell because I
want to show you what you want to look at when you go here.
So you're going to scroll down and go and look at the README file here.
This section here, this Get PowerShell section, this is the important part.
This shows you all the platforms where you can install it.
You can also download the particular packages,
such as an MSI file or a ZIP file, and there are instructions that you
can follow for the different platforms. So you can install PowerShell
7 right manually from the GitHub repo,
or I'm going to show you a way that I do it using a PowerShell command.
So let's close this and go back here to PowerShell.
Now, there's a module on the PowerShell Gallery called PSRelease Tools.
This is something I wrote a couple years ago when PowerShell Core first came
out, and we're going to check to see here what is available.
You may see a different version. So, that is the version, I
know it's not installed on my machine, so I'm going to go ahead and install it.
We'll do Install‑Module PSReleaseTools.
You may get prompted to install a new version of NuGet,
or you may see a prompt like this because the PowerShell Gallery is not trusted.
I will get this prompt and I will go ahead and trust it,
so it will now go and download and install that module.
You can see it goes pretty quickly.
In that module, there is a command called Get‑PSReleaseCurrent,
and this will show me the current release, the current stable
release, that is, from the GitHub repo.
And as you can see, that is version 7 of PowerShell 7.
Within the module,
I have a command called Get‑PSReleaseAsset, and you can look at help
if you know some Windows PowerShell to retrieve the download files
directly from PowerShell. So I can run Get‑PSReleaseAsset, and
there's a parameter for the Windows Family, and say all I care about
are the 64‑bit packages.
So there is a package for an MSI and also for the ZIP.
So, what I can do is if I wanted to I could download that MSI file and
then manually install it, and I might do it like this.
I might make a directory for the PS7 files,
and then I can do my Get‑PSReleaseAsset for the Windows Family, the 64
bit, in this case also limit the format to just MSI, and then pipe that
to Save‑PSReleaseAsset and then the path.
Now I'm including ‑WhatIf because I don't really want
to download and install it this way.
Instead,
the easy way is to use Install‑PowerShell. This will install the
latest PowerShell 7 version on Windows. So really quickly, it's as
simple as typing Install‑PowerShell, I want to enable PowerShell
remoting and I want to enable the context menu so that I get that in
Explorer, and press Enter. This now is going to download and install
PowerShell. Well, in my particular case,
there is a Mode parameter.
You can specify whether you want the full MSI package installation,
which is what I'm going to get because I didn't specify either
quiet or passive. You can use this command.
What I like about it is I can install PowerShell 7 with all my
parameters quietly, basically in the background.
So, I have other laptops that I use and I just kick off
this task and install PowerShell 7 completely unattended,
not to have to deal with it.
If you have your own MSI or own software deployment tools or
mechanisms, certainly go ahead and use those.
So, we're going to let this finish downloading,
and we'll be back in a few minutes when it completes, and when it completes,
it will start the PowerShell 7 installation.
So I'll be back in just a moment.
All right,
so the download finished and the GUI part of the installation has kicked off,
so I want you to see what this looks like. So we'll go ahead and click Next.
Really not that more difficult than any other application you've ever installed.
We'll go ahead and accept the defaults. There's really no reason to change that.
And I want to enable all of these things.
I want PowerShell remoting enabled.
Now, I've got some of these clicked because I included that in my parameters.
But if not, I would check that here. And let's go ahead and click Next,
Install. This takes but just a moment. And it's done. Now,
I sped things up a little bit so you didn't have to watch the
progress bar creep along, but it does not take that long, and
now PowerShell 7 is set up.
I'm not going to install it right from here, I'm going to
leave that Launch PowerShell unchecked,
but we'll go ahead and click Finish. And now we'll go ahead and
just clear the host here. And to show you that I can get into
PowerShell 7, I can run it right from here.
I can type pwsh, press Enter, and actually, as you can see, that did not work.
And I've shown that because you may think, oh, I'll
just type pwsh and it will work.
Well,
what's happened is we wanted to do the install that modified the
environment path so that PowerShell 7 can be detected This instance of
Windows PowerShell doesn't know about that new change, so it can't find
pwsh in the path. So I'll have to start a new PowerShell session in order
for this to work. To show you what I'm talking about, now that I've
restarted PowerShell, now I can run pwsh and you can see that I have
started PowerShell 7.
We'll get into more about running and working with
PowerShell 7 in another module.
But, I do want to show you this little link here.
Don't just ignore it, go ahead and look at it.
So let's do start and I just copy and paste that there because this is a very
important page a lot of people don't go and look at. This has everything you
need to know about PowerShell. There's documentation, there's tools, there
are editors, gallery, related information, community resources, so I want to
make sure you know that this exists and you take some time to look through
this. Bookmark this.
This is a great resource that you should be using. A lot of people
aren't aware of it. Microsoft tells you about it right here when
you start PowerShell, but a lot people just are in a hurry to get
going and they miss that.
So I think you'll find that very useful.
When you're done, we'll just do exit, and exit to go back to Windows.
All right, so that is how easy it is to install PowerShell 7.
Coming up, we'll look at more about how you can get around in PowerShell 7
and start discovering what you can do in PowerShell 7.
But that's it for this demo, so let's go back to the slides and wrap up this module.