Hyper-V Server 2019 installation and usage record
System image download and installation #
Download address: 17763.737.190906-2324.rs5_release_svc_refresh_SERVERHYPERCORE_OEM_x64FRE_zh-cn_1.iso
The installation process is very simple. It is no different from installing the Windows operating system. It is not recorded here.
For the installation process, refer to: Installing Hyper-v Server 2016
1. Server side settings #
After the installation is completed, open powershell for the following settings
1. Enable local remote management
Enable-PSRemoting
2. Turn on CredSSP authentication
Enable-WSManCredSSP -role server
3. Turn off firewall
netsh advfirewall set currentprofile state off
At this point, the server can be operated remotely without other settings.
2. Client machine settings #
1. Set network status to private
Windows settings network and Internet status properties are private.
2. Enable Hyper-V management tools
Control panel program enable fire shut down Windows function check Hyper-V GUI management tool under hyper-v.
Here, you only need to install a Hyper-V GUI management tool to the local machine for remote operation of Hyper-V virtual machine, so you don't need to install Hyper-V platform software (this conflicts with VirtualBox).
3. Add the IP address of the Hyper-V Server to the HOSTS record
This can also be accessed directly through the host name without adding.
4. Modify Group Policy
Run gpedit MSc program, navigate to the "computer configuration" management template "system" to allow new credentials to be assigned for NTLM server authentication only
Enable this setting and add the following servers to the list
wsman/* termsvr/*
5. Configure Windows remote management
Open the native powershell and execute the following command
# Enable winrm winrm quickconfig # winrm security configuration. The last parameter value is the host name (domain name) of Hyper-V server Set-Item WSMan:\localhost\Client\TrustedHosts -Value "MiniPC-HyperV" # winrm authentication configuration Enable-WSManCredSSP -Role client -DelegateComputer "MiniPC-HyperV"
6. Connect to the server using Hyper-V Manager
At this time, you can open Hyper-V manager, right-click the Hyper-V manager control on the left, and select connect to server.
3. PowerShell remote add shared directory #
After using Hyper-V manager to connect to the server, you can perform virtual machine related operations. You need to upload the local system image to the server, so add a shared directory to the server.
Powershell login server
Enter-PSSession MiniPC-HyperV -Credential administrator # Input password [MiniPC-HyperV]: PS C:\Users\Administrator\Documents>
View current shared resources
[MiniPC-HyperV]: PS C:\> net share Share name resources annotation ------------------------------------------------------------------------------- C$ C:\ Default share IPC$ long-range IPC ADMIN$ C:\Windows Remote management Command completed successfully.
Create a shared resource
# Create a folder to share [MiniPC-HyperV]: PS C:\> mkdir C:\share # Shared directory physical path [MiniPC-HyperV]: PS C:\> $ShareFolderPhysicalPath="C:\share" # Share name [MiniPC-HyperV]: PS C:\> $ShareFolderNetworkPath="share" # Call WMI object WIN32_Share class [MiniPC-HyperV]: PS C:\> $ShareHandle=[WMIClass]"WIN32_Share" # WMI object Win32_ Member method of share class [MiniPC-HyperV]: PS C:\> $ShareHandle | Get-Member -MemberType method TypeName:System.Management.ManagementClass#ROOT\cimv2\Win32_Share Name MemberType Definition ---- ---------- ---------- Create Method System.Management.ManagementBaseObject Create(System.String Path, System.String Name, System.UInt3... # View information about the Create method [MiniPC-HyperV]: PS C:\> $ShareHandle.Create OverloadDefinitions ------------------- System.Management.ManagementBaseObject Create(System.String Path, System.String Name, System.UInt32 Type, System.UInt32 MaximumAllowed, System.String Description, System.String Password, System.Management.ManagementObject#Win32_SecurityDe scriptor Access) # Create directory share [MiniPC-HyperV]: PS C:\> $ShareHandle.Create($ShareFolderPhysicalPath,$ShareFolderNetworkPath,0) __GENUS : 2 __CLASS : __PARAMETERS __SUPERCLASS : __DYNASTY : __PARAMETERS __RELPATH : __PROPERTY_COUNT : 1 __DERIVATION : {} __SERVER : __NAMESPACE : __PATH : ReturnValue : 0 PSComputerName : # Check whether the directory is shared [MiniPC-HyperV]: PS C:\> Get-WmiObject WIN32_Share | where { >> ($_.Path -eq $ShareFolderPhysicalPath) -and ($_.Name -eq $ShareFolderNetworkPath) >> } Name Path Description ---- ---- ----------- share C:\share # Or check it this way [MiniPC-HyperV]: PS C:\> net share Share name resources annotation ------------------------------------------------------------------------------- C$ C:\ Default share IPC$ long-range IPC ADMIN$ C:\Windows Remote management share C:\share Command completed successfully.
Assign permissions to shared directories (all)
[MiniPC-HyperV]: PS C:\> Grant-SmbShareAccess -name $ShareFolderNetworkPath -AccountName Everyone -AccessRight Full confirm Are you sure you want to perform this operation? Performing operation“ Modify"(Target“*,share"). [Y] yes(Y) [A] All(A) [N] no(N) [L] All no(L) [?] help (The default value is“ Y"): Y Name ScopeName AccountName AccessControlType AccessRight ---- --------- ----------- ----------------- ----------- share * Everyone Allow Full
reference resources: