Skip to content

Instantly share code, notes, and snippets.

@ByronScottJones
Last active September 3, 2020 00:58
Show Gist options
  • Save ByronScottJones/c5a48bf6b21febb1543aa9e891a60676 to your computer and use it in GitHub Desktop.
Save ByronScottJones/c5a48bf6b21febb1543aa9e891a60676 to your computer and use it in GitHub Desktop.
Hyper-V Management Config
#Run the following commands on server:
Enable-PSRemoting
Enable-WSManCredSSP -Role server
Enable-NetFirewallRule -DisplayGroup “Windows Remote Management”
Enable-NetFirewallRule -DisplayGroup “Remote Event Log Management”
Enable-NetFirewallRule -DisplayGroup “Remote Volume Management”
Set-Service VDS -StartupType Automatic
Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'client_hostname' -Concatenate
#Reboot the server (select #12 from Hyper-V Core Menu)
#Run the following commands on your client machine:
#Launch an elevated PowerShell prompt
#Install the Hyper-V Manager (Reboot may be needed)
DISM /online /enable-feature /featurename:Microsoft-Hyper-V-Management-Clients -All
#Set the Network Connection type to Private (May not be needed)
Get-NetAdapter|Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceAlias "Name_of_Network_Connection" -NetworkCategory Private
#Enable Remote Volume (Disk) Management
Enable-NetFirewallRule -DisplayGroup “Remote Volume Management”
#Start the Windows Remote Management Service
Start-Service -Name winrm
#Add the Server as a WSMan Trusted Host
Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'server_hostname' -Concatenate
Enable-PSRemoting -SkipNetworkProfileCheck -Force
enable-wsmancredssp -role client -delegatecomputer server_hostname
#Add Server name and IP
notepad c:\windows\system32\drivers\etc\hosts
#Store the Server Credentials
cmdkey /add:"server.fqdn" /user:server\Administrator" /pass:<REDACTED>
#Test the Remote Connection
#Invoke-Command {whoami} -ComputerName "server.fqdn" -Credential "server_fqdn\Administrator"
Invoke-Command {whoami} -ComputerName "server.fqdn"
#Run the Hyper-V Manager as the server administrator
runas /user:"server_fqdn\Administrator" /netonly "mmc virtmgmt.msc"
#https://github.com/MicrosoftDocs/Virtualization-Documentation/issues/887
Open "Window Security"
Open "App & Browser control"
Click "Exploit protection settings" at the bottom
Switch to "Program settings" tab
Locate "C:\WINDOWS\System32\vmcompute.exe" in the list and expand it
Click "Edit"
Scroll down to "Code flow guard (CFG)" and uncheck "Override system settings"
Start vmcompute from powershell as administrator net start vmcompute
Restart
# -- OR --
MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof
@ByronScottJones
Copy link
Author

ByronScottJones commented Sep 3, 2020

`​
Enable-PSRemoting -SkipNetworkProfileCheck -Force

Set-WSManInstance WinRM/Config/WinRS -ValueSet @{MaxMemoryPerShellMB = 1024}
Set-WSManInstance WinRM/Config -ValueSet @{MaxTimeoutms=1800000}
Set-WSManInstance WinRM/Config/Client -ValueSet @{TrustedHosts="*"}
Set-WSManInstance WinRM/Config/Service/Auth -ValueSet @{Negotiate = $true}
`

@ByronScottJones
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment