So, let's go into our environment and we'll install PowerShell on Windows.
We'll then install PowerShell on Linux,
and then we'll install PowerShell on macOS.
So here we are on a Windows 10 machine,
and we would like to install the latest cross‑platform
version of PowerShell directly into Windows.
Now, we can do this in a few ways.
We can download using the MSI package that we can just download from GitHub,
or we could do the ZIP file,
or we could even just use dotnet tool install and do it that way,
or even just use other PowerShell installs.
The option that I like using for Windows is the Windows Package Manager,
or otherwise known as winget.
So I'm going to first open up the cmd command here,
I'm going to say Run as administrator, and then I'm going to maximize that here.
I can then type winget,
and you'll see it tells me the version of the winget package manager,
which is version 1.3, etc., and then gives me a list of all the commands.
Now to make sure we have the latest version,
I'm going to close that,
and then I'm going to launch my store. And in the Microsoft store,
I'm going to look for something called App Installer,
and then it says the product is installed.
I can say Get.
If there's an update, I'm going to say no,
I don't want to sign in, I just want to go ahead and do an update.
It'll say Install on my devices; the product's been installed.
Now, if this isn't an updated version,
what it will do is it will try to update and it will
provide you an updated version.
Now, now that that's completed, we can minimize this,
I can go back to my Start command here, run as administrator again,
maximize that, and then we'll say winget,
and you'll see it's now 1.3.2091.
So if there was a newer version, it would be updated.
Okay, so let me just clear the screen here,
and what we want to do is actually install the latest version of PowerShell,
so we're going to do this by typing winget install,
and then we pass the id of the application,
which luckily for us is called Microsoft.PowerShell, and I can press Enter now.
Now what this does, you'll see it's doing some checks, then it will say okay,
we need to perform a specific type of transaction,
are you okay with the terms?
Yes, I am.
And now it's going to go ahead.
Notice what it's doing here, you can see the direct GitHub link,
the PowerShell GitHub link is listed here,
so we could have used that instead, but this is doing all of it for us.
It's going to prompt us for the install,
you can see it's configuring PowerShell 7 automatically,
so we'll leave this to go.
This will take a couple of seconds to complete.
Okay, so it's been successfully installed.
Now what does that do?
Well, what it does, if we click the Start menu,
is we now have a PowerShell 7 option, which I'm going to click here.
Okay, so as you can see, we've now installed PowerShell 7.2.6,
which is the latest version of the cross‑platform.
So what we'll do now is move away from our Windows machine,
and we'll go to a Linux machine, specifically an Ubuntu machine,
and we'll also install the exact same version of PowerShell directly there.
So here we are on our Ubuntu Linux machine,
and just like with Windows, we could actually download the file,
so the DEV files, or if we're using Red Hat,
for example, or some other type of Linux,
maybe the RPM or whatever file extension it would be for that Linux version.
We can also use the dotnet tool install,
but for Linux, I often like to use the snap package.
So I'm going to click into my terminal, which takes me straight here,
and I'm going to type sudo snap install,
and then the name, powershell,
and then I'm going to type the word classic to make
sure it downloads the right version.
It's going to ask me for the password for my trainer
account because I'm using sudo.
Once that's done, it's going to go ahead and say okay,
we need to download some pieces for snap,
which are core components that are required for the install,
it shouldn't take too long here,
and then it will move on to the PowerShell piece once that's completed.
So there we go, it says downloading snap powershell.
We're going to get the latest stable version,
and then if we give that a second,
you should see it start to do the install and move onto the PowerShell piece.
There we go.
So PowerShell is now completed.
So let me click my applications, and if I go here and type PowerShell,
you can see PowerShell 7 shows up here.
This should load for us, and there we go,
PowerShell 7.2.6 is now available on Ubuntu Linux,
exactly the same as we did for the Windows.
So for our last example,
we're now going to hop onto a macOS device and
complete the same steps as we did before,
but this time on macOS,
so that will give you a picture of how to install the cross‑platform
PowerShell into three different operating systems.
So here we are on the Mac machine,
and the first thing we're going to do is scroll down and
actually do a different type of install where we're going to
download the actual compressed file.
So it'll be a PKG file, and we can simply look through the list,
looking for the right version, and you'll see I've got osx‑x64,
so I'm going to click on this one.
This'll then ask me to download,
I'm going to click Allow, this will now go ahead and download the PKG file.
Now, once we have the package file installed,
we can actually simply double‑click.
So let me go into the Finder, go to my Downloads,
you'll see I've got the package file, I can double‑click here,
it'll pop up, and notice what happens. It gives me an
error that says it could be malicious, it's not from Apple.
Now if you're on an OS X device,
then you can Ctrl+Click and you can do the Open option,
which will then come in and give you another message,
but you can then say open, and it will go through the install that way.
And we'll click through that in a second.
The other option that you have is to launch a terminal window,
and then from here, we can actually navigate into the folder,
so the downloads one.
Let me just double‑check.
So if I do ls, you can see that my package file is there,
and then I can actually do sudo installer pkg.
If I do PowerShell, like so, target /,
then that will actually let me do the install.
I actually just realized, just a lesson learned here,
make sure that we put that at the front of it,
otherwise, it won't install.
So that's one option we can get around it because that will launch it as sudo,
which is kind of a similar approach that we can use when doing the control.
So I'm going to minimize the terminal because I actually
just want to use the actual installer.
So we can click Continue now, and we'll click Install.
It's going to ask me for the password, just like the sudo would.
The install is going to go ahead and say it's successfully installed.
I'm going to say Move to Trash, because I don't need it, close that down.
And then I can click Launchpad here, and you'll see PowerShell exists,
and then it launches here, and you'll see it's now going to load PowerShell.
And look at the version, it says PowerShell 7.2.6.
So as you can see,
we can install PowerShell cross‑platform using almost the same approaches,
whether it's downloading an executable, or a ZIP file,
or a package file, or running a command line,
or a combination of both.
But we can definitely install PowerShell cross‑platform and
get access to the same types of commands.