Hyper‑V and PowerShell Remoting.
A common point of confusion I find when I teach PowerShell
particularly to Windows server administrators is the
difference between PowerShell remoting,
which we've covered previously in the AZ‑800 learning path,
and PowerShell Direct.
What's the difference?
Well, PowerShell remoting is a capability that you enable on a target system.
Now you don't actually have to enable PS remoting in Windows
Server because it's enabled by default,
but let's say for some reason you wanted to send
remote PowerShell to client systems.
Windows Client does not have PS remoting enabled.
You would need to do that on those machines.
PowerShell remoting, once it's enabled,
provides near universal connectivity among Windows, and frankly,
in a cross‑platform world with PowerShell 7,
you can go across Windows into macOS and Linux.
However, the Az‑800 and 801 focus specifically on Windows,
so that's what I'm going to do in this course.
So this means that PS remoting unlocks mass PowerShell‑based management
of both server and client systems running on‑prem,
Azure, and beyond.
The underlying transport is governed by the Windows Remote Management,
or WinRM service, using the WS‑Man protocol with HTTP or HTTPS.
So those are some hallmarks of PowerShell remoting. It's been around
for a long time. It's a mature technology. Now,
PowerShell Direct is a feature of Hyper‑V in particular, and one
thing I want you to see that PowerShell Direct VMs do not need to
be enabled for PS remoting. Again,
if you have VMs that are running Windows Server,
they're already enabled for PowerShell remoting, but they don't need to be.
However,
the ability to send PowerShell from the host to your
VMs is constrained to that host.
In other words, you have to issue your PowerShell commands from the Hyper‑V
host directly to the guest VM that is on that host. That's why it's called
PowerShell Direct. And the transport is actually named pipes, so we're not
even using Win‑RM and WS management.
How can I sum it up?
Well, PowerShell remoting is universal remote management,
whereas PowerShell Direct is much more specialized and limited only to the
Hyper‑V host and its contained guest VMs. What is HVC?
Well,
this is a compiled executable that allows an analogous
technique. That is, HVC is to Hyper‑V Linux VMs to what
PowerShell Direct is to Hyper‑V Windows Server VMs.
Now, this is a little bit controversial inasmuch as
if you're doing PowerShell 7,
there's a lot of cross‑platform remote administration out of the box. I'm
including this slide simply because it's currently on the exam AZ‑800
objectives. What HVC allows you to do is when you have Linux virtual
machines running on Windows Hyper‑V, which you can nowadays, you can send
bash commands like Secure Shell,
SSH, directly from the Hyper‑V host into that Linux VM. So as you see, to do an
SSH client session into your VM, you can invoke hvc ssh user @vmname
authenticate using a key or a password, and then you're in.
Likewise, HVC allows for file transfer to where we could do SCP file copy, hvc
space scp, and then in this case, we're going to recursively copy scripts/bash
from the local machine into the virtual machine home directory. You see? So we
could sum up by saying HVC.EXE is part of Hyper‑V that offers SSH Direct for
Linux VMs. Again, I mention it here,
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.