WEBVTT

00:00:01.700 --> 00:00:06.300
So, let's go into our environment and we'll install PowerShell on Windows.

00:00:06.970 --> 00:00:09.040
We'll then install PowerShell on Linux,

00:00:09.800 --> 00:00:12.450
and then we'll install PowerShell on macOS.

00:00:13.660 --> 00:00:15.910
So here we are on a Windows 10 machine,

00:00:16.190 --> 00:00:18.940
and we would like to install the latest cross‑platform

00:00:18.940 --> 00:00:21.510
version of PowerShell directly into Windows.

00:00:21.930 --> 00:00:23.480
Now, we can do this in a few ways.

00:00:23.490 --> 00:00:27.700
We can download using the MSI package that we can just download from GitHub,

00:00:27.710 --> 00:00:29.230
or we could do the ZIP file,

00:00:29.240 --> 00:00:33.780
or we could even just use dotnet tool install and do it that way,

00:00:33.790 --> 00:00:36.530
or even just use other PowerShell installs.

00:00:36.890 --> 00:00:39.950
The option that I like using for Windows is the Windows Package Manager,

00:00:39.950 --> 00:00:42.120
or otherwise known as winget.

00:00:42.350 --> 00:00:45.770
So I'm going to first open up the cmd command here,

00:00:45.790 --> 00:00:50.210
I'm going to say Run as administrator, and then I'm going to maximize that here.

00:00:50.330 --> 00:00:52.140
I can then type winget,

00:00:52.650 --> 00:00:56.300
and you'll see it tells me the version of the winget package manager,

00:00:56.300 --> 00:01:00.590
which is version 1.3, etc., and then gives me a list of all the commands.

00:01:00.930 --> 00:01:02.870
Now to make sure we have the latest version,

00:01:02.880 --> 00:01:04.140
I'm going to close that,

00:01:04.230 --> 00:01:08.000
and then I'm going to launch my store. And in the Microsoft store,

00:01:08.000 --> 00:01:10.450
I'm going to look for something called App Installer,

00:01:10.800 --> 00:01:13.150
and then it says the product is installed.

00:01:13.160 --> 00:01:14.600
I can say Get.

00:01:14.600 --> 00:01:16.970
If there's an update, I'm going to say no,

00:01:16.970 --> 00:01:20.160
I don't want to sign in, I just want to go ahead and do an update.

00:01:20.280 --> 00:01:23.780
It'll say Install on my devices; the product's been installed.

00:01:24.210 --> 00:01:26.440
Now, if this isn't an updated version,

00:01:26.450 --> 00:01:28.900
what it will do is it will try to update and it will

00:01:28.900 --> 00:01:31.440
provide you an updated version.

00:01:31.970 --> 00:01:34.510
Now, now that that's completed, we can minimize this,

00:01:34.830 --> 00:01:38.750
I can go back to my Start command here, run as administrator again,

00:01:39.400 --> 00:01:42.590
maximize that, and then we'll say winget,

00:01:42.780 --> 00:01:45.800
and you'll see it's now 1.3.2091.

00:01:45.800 --> 00:01:48.020
So if there was a newer version, it would be updated.

00:01:48.640 --> 00:01:50.660
Okay, so let me just clear the screen here,

00:01:50.660 --> 00:01:54.390
and what we want to do is actually install the latest version of PowerShell,

00:01:54.400 --> 00:01:58.160
so we're going to do this by typing winget install,

00:01:58.350 --> 00:02:01.420
and then we pass the id of the application,

00:02:01.420 --> 00:02:06.700
which luckily for us is called Microsoft.PowerShell, and I can press Enter now.

00:02:06.700 --> 00:02:11.300
Now what this does, you'll see it's doing some checks, then it will say okay,

00:02:11.300 --> 00:02:14.310
we need to perform a specific type of transaction,

00:02:14.310 --> 00:02:15.640
are you okay with the terms?

00:02:15.650 --> 00:02:16.510
Yes, I am.

00:02:16.860 --> 00:02:17.990
And now it's going to go ahead.

00:02:17.990 --> 00:02:22.030
Notice what it's doing here, you can see the direct GitHub link,

00:02:22.100 --> 00:02:24.750
the PowerShell GitHub link is listed here,

00:02:24.760 --> 00:02:29.030
so we could have used that instead, but this is doing all of it for us.

00:02:29.270 --> 00:02:30.900
It's going to prompt us for the install,

00:02:30.900 --> 00:02:34.330
you can see it's configuring PowerShell 7 automatically,

00:02:34.380 --> 00:02:35.380
so we'll leave this to go.

00:02:35.380 --> 00:02:37.820
This will take a couple of seconds to complete.

00:02:39.100 --> 00:02:41.120
Okay, so it's been successfully installed.

00:02:41.120 --> 00:02:42.210
Now what does that do?

00:02:42.450 --> 00:02:44.440
Well, what it does, if we click the Start menu,

00:02:44.450 --> 00:02:47.850
is we now have a PowerShell 7 option, which I'm going to click here.

00:02:47.890 --> 00:02:51.840
Okay, so as you can see, we've now installed PowerShell 7.2.6,

00:02:51.840 --> 00:02:55.350
which is the latest version of the cross‑platform.

00:02:55.600 --> 00:02:58.670
So what we'll do now is move away from our Windows machine,

00:02:58.680 --> 00:03:02.740
and we'll go to a Linux machine, specifically an Ubuntu machine,

00:03:02.750 --> 00:03:07.390
and we'll also install the exact same version of PowerShell directly there.

00:03:07.530 --> 00:03:10.280
So here we are on our Ubuntu Linux machine,

00:03:10.420 --> 00:03:15.220
and just like with Windows, we could actually download the file,

00:03:15.230 --> 00:03:17.710
so the DEV files, or if we're using Red Hat,

00:03:17.710 --> 00:03:19.210
for example, or some other type of Linux,

00:03:19.210 --> 00:03:23.620
maybe the RPM or whatever file extension it would be for that Linux version.

00:03:23.790 --> 00:03:27.010
We can also use the dotnet tool install,

00:03:27.060 --> 00:03:29.920
but for Linux, I often like to use the snap package.

00:03:29.920 --> 00:03:33.580
So I'm going to click into my terminal, which takes me straight here,

00:03:33.770 --> 00:03:38.610
and I'm going to type sudo snap install,

00:03:39.050 --> 00:03:41.190
and then the name, powershell,

00:03:41.690 --> 00:03:44.120
and then I'm going to type the word classic to make

00:03:44.120 --> 00:03:45.900
sure it downloads the right version.

00:03:46.420 --> 00:03:48.940
It's going to ask me for the password for my trainer

00:03:48.940 --> 00:03:50.470
account because I'm using sudo.

00:03:51.100 --> 00:03:54.290
Once that's done, it's going to go ahead and say okay,

00:03:54.300 --> 00:03:56.620
we need to download some pieces for snap,

00:03:56.620 --> 00:03:59.780
which are core components that are required for the install,

00:03:59.780 --> 00:04:01.380
it shouldn't take too long here,

00:04:01.600 --> 00:04:06.320
and then it will move on to the PowerShell piece once that's completed.

00:04:06.320 --> 00:04:08.920
So there we go, it says downloading snap powershell.

00:04:09.020 --> 00:04:11.530
We're going to get the latest stable version,

00:04:12.150 --> 00:04:13.440
and then if we give that a second,

00:04:13.440 --> 00:04:17.950
you should see it start to do the install and move onto the PowerShell piece.

00:04:18.680 --> 00:04:19.320
There we go.

00:04:19.329 --> 00:04:20.980
So PowerShell is now completed.

00:04:21.019 --> 00:04:26.820
So let me click my applications, and if I go here and type PowerShell,

00:04:26.830 --> 00:04:29.580
you can see PowerShell 7 shows up here.

00:04:29.590 --> 00:04:31.540
This should load for us, and there we go,

00:04:31.540 --> 00:04:35.640
PowerShell 7.2.6 is now available on Ubuntu Linux,

00:04:36.450 --> 00:04:39.340
exactly the same as we did for the Windows.

00:04:40.040 --> 00:04:41.450
So for our last example,

00:04:41.460 --> 00:04:44.150
we're now going to hop onto a macOS device and

00:04:44.150 --> 00:04:47.440
complete the same steps as we did before,

00:04:47.440 --> 00:04:48.940
but this time on macOS,

00:04:48.950 --> 00:04:52.970
so that will give you a picture of how to install the cross‑platform

00:04:52.970 --> 00:04:56.570
PowerShell into three different operating systems.

00:04:56.580 --> 00:04:59.400
So here we are on the Mac machine,

00:04:59.460 --> 00:05:01.900
and the first thing we're going to do is scroll down and

00:05:01.900 --> 00:05:03.920
actually do a different type of install where we're going to

00:05:03.920 --> 00:05:06.740
download the actual compressed file.

00:05:06.740 --> 00:05:10.850
So it'll be a PKG file, and we can simply look through the list,

00:05:10.850 --> 00:05:14.860
looking for the right version, and you'll see I've got osx‑x64,

00:05:14.860 --> 00:05:16.170
so I'm going to click on this one.

00:05:16.460 --> 00:05:18.380
This'll then ask me to download,

00:05:18.390 --> 00:05:23.110
I'm going to click Allow, this will now go ahead and download the PKG file.

00:05:23.540 --> 00:05:25.650
Now, once we have the package file installed,

00:05:25.650 --> 00:05:27.660
we can actually simply double‑click.

00:05:27.660 --> 00:05:30.510
So let me go into the Finder, go to my Downloads,

00:05:30.510 --> 00:05:33.500
you'll see I've got the package file, I can double‑click here,

00:05:34.120 --> 00:05:37.120
it'll pop up, and notice what happens. It gives me an

00:05:37.130 --> 00:05:40.980
error that says it could be malicious, it's not from Apple.

00:05:41.300 --> 00:05:43.950
Now if you're on an OS X device,

00:05:43.970 --> 00:05:48.730
then you can Ctrl+Click and you can do the Open option,

00:05:48.740 --> 00:05:51.800
which will then come in and give you another message,

00:05:51.800 --> 00:05:55.410
but you can then say open, and it will go through the install that way.

00:05:55.800 --> 00:05:57.260
And we'll click through that in a second.

00:05:57.270 --> 00:06:00.780
The other option that you have is to launch a terminal window,

00:06:02.480 --> 00:06:07.480
and then from here, we can actually navigate into the folder,

00:06:07.490 --> 00:06:08.700
so the downloads one.

00:06:08.710 --> 00:06:10.040
Let me just double‑check.

00:06:10.760 --> 00:06:14.750
So if I do ls, you can see that my package file is there,

00:06:14.840 --> 00:06:20.840
and then I can actually do sudo installer pkg.

00:06:22.320 --> 00:06:25.610
If I do PowerShell, like so, target /,

00:06:25.610 --> 00:06:28.800
then that will actually let me do the install.

00:06:28.810 --> 00:06:32.000
I actually just realized, just a lesson learned here,

00:06:32.010 --> 00:06:34.910
make sure that we put that at the front of it,

00:06:34.920 --> 00:06:36.030
otherwise, it won't install.

00:06:36.040 --> 00:06:39.610
So that's one option we can get around it because that will launch it as sudo,

00:06:39.610 --> 00:06:42.990
which is kind of a similar approach that we can use when doing the control.

00:06:42.990 --> 00:06:45.370
So I'm going to minimize the terminal because I actually

00:06:45.370 --> 00:06:47.620
just want to use the actual installer.

00:06:47.690 --> 00:06:50.550
So we can click Continue now, and we'll click Install.

00:06:50.550 --> 00:06:57.110
It's going to ask me for the password, just like the sudo would.

00:06:57.110 --> 00:07:01.270
The install is going to go ahead and say it's successfully installed.

00:07:01.330 --> 00:07:04.340
I'm going to say Move to Trash, because I don't need it, close that down.

00:07:04.340 --> 00:07:08.200
And then I can click Launchpad here, and you'll see PowerShell exists,

00:07:08.420 --> 00:07:12.570
and then it launches here, and you'll see it's now going to load PowerShell.

00:07:12.580 --> 00:07:16.600
And look at the version, it says PowerShell 7.2.6.

00:07:16.660 --> 00:07:18.010
So as you can see,

00:07:18.020 --> 00:07:23.130
we can install PowerShell cross‑platform using almost the same approaches,

00:07:23.140 --> 00:07:26.930
whether it's downloading an executable, or a ZIP file,

00:07:26.930 --> 00:07:30.240
or a package file, or running a command line,

00:07:30.250 --> 00:07:31.680
or a combination of both.

00:07:31.690 --> 00:07:35.140
But we can definitely install PowerShell cross‑platform and

00:07:35.140 --> 00:07:37.790
get access to the same types of commands.
