Last active
December 22, 2016 07:56
-
-
Save bobalob/d0a659c336a4a62f55b4d2e9f08ec901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
$ServerName = "WIN-VCEI81MP4AD", | |
$UserAccountName="HypervUser", | |
$UserAccountPassword="P@ssw0rd1" | |
) | |
#The next line actually installs ALL hyper-v features including the hypervisor, | |
# I haven't had time to fix this yet so if this isn't acceptable you should | |
# remove the line and install the hyper-v client tools manually | |
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-Clients -all -NoRestart | |
Set-Service WinRM -StartupType Automatic | |
Start-Service WinRM | |
if ((Get-ChildItem WSMan:\localhost\Client\TrustedHosts).Value -ne "") { | |
$Current = (Get-ChildItem WSMan:\localhost\Client\TrustedHosts).Value | |
$NewVal = "$($Current), $ServerName.*, $ServerName" | |
} else { | |
$NewVal = "$ServerName.*, $ServerName" | |
} | |
Set-Item WSMan:\localhost\Client\TrustedHosts $NewVal -Force | |
cmdkey /add:$ServerName /user:$ServerName\$UserAccountName /pass:$UserAccountPassword |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment