Skip to content

Instantly share code, notes, and snippets.

@jakejscott
Forked from mitchellh/setup_winrm.txt
Last active September 1, 2015 00:59
Show Gist options
  • Select an option

  • Save jakejscott/ef56d7253a8c50f24cf3 to your computer and use it in GitHub Desktop.

Select an option

Save jakejscott/ef56d7253a8c50f24cf3 to your computer and use it in GitHub Desktop.

Revisions

  1. @mitchellh mitchellh created this gist Jun 14, 2015.
    16 changes: 16 additions & 0 deletions setup_winrm.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    <powershell>
    winrm quickconfig -q
    winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}'
    winrm set winrm/config '@{MaxTimeoutms="1800000"}'
    winrm set winrm/config/service '@{AllowUnencrypted="true"}'
    winrm set winrm/config/service/auth '@{Basic="true"}'

    netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
    netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow

    net stop winrm
    sc config winrm start=auto
    net start winrm

    Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine
    </powershell>
    22 changes: 22 additions & 0 deletions template.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    {
    "builders": [{
    "type": "amazon-ebs",
    "region": "us-east-1",
    "source_ami": "ami-c01102a8",
    "instance_type": "m3.medium",
    "ami_name": "windows-ami {{timestamp}}",
    "user_data_file": "{{template_dir}}/setup_winrm.txt",

    "communicator": "winrm",
    "winrm_username": "Administrator"
    }],

    "provisioners": [
    {
    "type": "powershell",
    "inline": [
    "dir c:\\"
    ]
    }
    ]
    }