1 00:00:01,040 --> 00:00:03,280 Hyper‑V and PowerShell Remoting. 2 00:00:03,280 --> 00:00:07,130 A common point of confusion I find when I teach PowerShell 3 00:00:07,130 --> 00:00:10,210 particularly to Windows server administrators is the 4 00:00:10,210 --> 00:00:12,250 difference between PowerShell remoting, 5 00:00:12,250 --> 00:00:15,720 which we've covered previously in the AZ‑800 learning path, 6 00:00:15,720 --> 00:00:17,220 and PowerShell Direct. 7 00:00:17,220 --> 00:00:18,240 What's the difference? 8 00:00:18,240 --> 00:00:23,570 Well, PowerShell remoting is a capability that you enable on a target system. 9 00:00:23,570 --> 00:00:26,660 Now you don't actually have to enable PS remoting in Windows 10 00:00:26,660 --> 00:00:28,680 Server because it's enabled by default, 11 00:00:28,680 --> 00:00:31,260 but let's say for some reason you wanted to send 12 00:00:31,260 --> 00:00:33,400 remote PowerShell to client systems. 13 00:00:33,400 --> 00:00:36,150 Windows Client does not have PS remoting enabled. 14 00:00:36,150 --> 00:00:38,700 You would need to do that on those machines. 15 00:00:38,700 --> 00:00:41,010 PowerShell remoting, once it's enabled, 16 00:00:41,010 --> 00:00:45,010 provides near universal connectivity among Windows, and frankly, 17 00:00:45,010 --> 00:00:47,600 in a cross‑platform world with PowerShell 7, 18 00:00:47,600 --> 00:00:50,660 you can go across Windows into macOS and Linux. 19 00:00:50,660 --> 00:00:54,730 However, the Az‑800 and 801 focus specifically on Windows, 20 00:00:54,730 --> 00:00:56,700 so that's what I'm going to do in this course. 21 00:00:56,700 --> 00:01:01,670 So this means that PS remoting unlocks mass PowerShell‑based management 22 00:01:01,670 --> 00:01:04,590 of both server and client systems running on‑prem, 23 00:01:04,590 --> 00:01:05,860 Azure, and beyond. 24 00:01:05,860 --> 00:01:09,970 The underlying transport is governed by the Windows Remote Management, 25 00:01:09,970 --> 00:01:15,990 or WinRM service, using the WS‑Man protocol with HTTP or HTTPS. 26 00:01:15,990 --> 00:01:19,340 So those are some hallmarks of PowerShell remoting. It's been around 27 00:01:19,340 --> 00:01:21,770 for a long time. It's a mature technology. Now, 28 00:01:21,770 --> 00:01:26,040 PowerShell Direct is a feature of Hyper‑V in particular, and one 29 00:01:26,040 --> 00:01:29,680 thing I want you to see that PowerShell Direct VMs do not need to 30 00:01:29,680 --> 00:01:31,800 be enabled for PS remoting. Again, 31 00:01:31,800 --> 00:01:34,250 if you have VMs that are running Windows Server, 32 00:01:34,250 --> 00:01:37,900 they're already enabled for PowerShell remoting, but they don't need to be. 33 00:01:37,900 --> 00:01:38,660 However, 34 00:01:38,660 --> 00:01:42,650 the ability to send PowerShell from the host to your 35 00:01:42,650 --> 00:01:45,510 VMs is constrained to that host. 36 00:01:45,510 --> 00:01:50,460 In other words, you have to issue your PowerShell commands from the Hyper‑V 37 00:01:50,460 --> 00:01:55,560 host directly to the guest VM that is on that host. That's why it's called 38 00:01:55,560 --> 00:01:59,610 PowerShell Direct. And the transport is actually named pipes, so we're not 39 00:01:59,610 --> 00:02:02,580 even using Win‑RM and WS management. 40 00:02:02,580 --> 00:02:03,690 How can I sum it up? 41 00:02:03,690 --> 00:02:07,140 Well, PowerShell remoting is universal remote management, 42 00:02:07,140 --> 00:02:11,270 whereas PowerShell Direct is much more specialized and limited only to the 43 00:02:11,270 --> 00:02:17,260 Hyper‑V host and its contained guest VMs. What is HVC? 44 00:02:17,260 --> 00:02:17,400 Well, 45 00:02:17,400 --> 00:02:21,110 this is a compiled executable that allows an analogous 46 00:02:21,110 --> 00:02:26,790 technique. That is, HVC is to Hyper‑V Linux VMs to what 47 00:02:26,790 --> 00:02:30,470 PowerShell Direct is to Hyper‑V Windows Server VMs. 48 00:02:30,470 --> 00:02:33,290 Now, this is a little bit controversial inasmuch as 49 00:02:33,290 --> 00:02:35,080 if you're doing PowerShell 7, 50 00:02:35,080 --> 00:02:39,220 there's a lot of cross‑platform remote administration out of the box. I'm 51 00:02:39,220 --> 00:02:43,930 including this slide simply because it's currently on the exam AZ‑800 52 00:02:43,930 --> 00:02:48,390 objectives. What HVC allows you to do is when you have Linux virtual 53 00:02:48,390 --> 00:02:53,580 machines running on Windows Hyper‑V, which you can nowadays, you can send 54 00:02:53,580 --> 00:02:56,070 bash commands like Secure Shell, 55 00:02:56,070 --> 00:03:02,290 SSH, directly from the Hyper‑V host into that Linux VM. So as you see, to do an 56 00:03:02,290 --> 00:03:09,680 SSH client session into your VM, you can invoke hvc ssh user @vmname 57 00:03:09,680 --> 00:03:13,110 authenticate using a key or a password, and then you're in. 58 00:03:13,110 --> 00:03:18,290 Likewise, HVC allows for file transfer to where we could do SCP file copy, hvc 59 00:03:18,290 --> 00:03:24,640 space scp, and then in this case, we're going to recursively copy scripts/bash 60 00:03:24,640 --> 00:03:29,780 from the local machine into the virtual machine home directory. You see? So we 61 00:03:29,780 --> 00:03:36,410 could sum up by saying HVC.EXE is part of Hyper‑V that offers SSH Direct for 62 00:03:36,410 --> 00:03:38,950 Linux VMs. Again, I mention it here, 63 00:03:38,950 --> 00:03:48,000 but we're really not focused on Linux VMs and Hyper‑V. It's just Windows Server. Now let's demo PowerShell remoting and PowerShell Direct.