forked from mitchellh/vagrant-rackspace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.cmd
More file actions
16 lines (15 loc) · 722 Bytes
/
bootstrap.cmd
File metadata and controls
16 lines (15 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Function SetupWinRM
{
Param(
[String]$hostname,
[String]$thumbprint
)
netsh advfirewall firewall set rule group="remote administration" new enable=yes
netsh advfirewall firewall add rule name="WinRM HTTP" dir=in action=allow protocol=TCP localport=5985
netsh advfirewall firewall add rule name="WinRM HTTPS" dir=in action=allow protocol=TCP localport=5986
winrm create winrm/config/Listener?Address=*+Transport=HTTPS "@{Hostname=`"${hostname}`"; CertificateThumbprint=`"${thumbprint}`"}"
}
$hostname = $env:COMPUTERNAME
$cert = New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -DnsName $hostname
$thumbprint = $cert.Thumbprint
SetupWinRM -hostname $hostname -thumbprint $thumbprint