# Windows Builder

Build Windows images with Packer using WinRM communicator and PowerShell provisioners.

- Repository: https://github.com/hashicorp/agent-skills (911 stars)
- Category: DevOps
- License: MPL-2.0
- Last updated: 2026-10-28
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add hashicorp/agent-skills --skill windows-builder -g -a claude-code -y`
Codex: `npx skills add hashicorp/agent-skills --skill windows-builder -g -a codex -y`
Cursor: `npx skills add hashicorp/agent-skills --skill windows-builder -g -a cursor -y`
Gemini CLI: `npx skills add hashicorp/agent-skills --skill windows-builder -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add hashicorp/agent-skills`

## Description

Build Windows images with Packer using WinRM communicator and PowerShell provisioners. Use when creating Windows AMIs, Azure images, or VMware templates.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Windows Builder

Platform-agnostic patterns for building Windows images with Packer.

**Reference:** [WinRM Communicator](https://developer.hashicorp.com/packer/docs/communicators/winrm)

> **Note:** Windows builds incur significant costs and time. Expect 45-120 minutes per build due to Windows Updates. Failed builds may leave resources running - always verify cleanup.

## WinRM Communicator Setup

Windows requires WinRM for Packer communication.

### AWS Example

```hcl
source "amazon-ebs" "windows" {
  region        = "us-west-2"
  instance_type = "t3.medium"

  source_ami_filter {
    filters = {
      name = "Windows_Server-2022-English-Full-Base-*"
    }
    most_recent = true
    owners      = ["amazon"]
  }

  ami_name = "windows-server-2022-${local.timestamp}"

  communicator   = "winrm"
  winrm_username = "Administrator"
  winrm_use_ssl  = true
  winrm_insecure = true
  winrm_timeout  = "15m"

  user_data_file = "scripts/setup-winrm.ps1"
}
```

### WinRM Setup Script (scripts/setup-winrm.ps1)

```powershell
<powershell>
# Configure WinRM
winrm quickconfig -q
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'

# Configure firewall
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

# Restart WinRM
net stop winrm
net start winrm
</powershell>
```

### Azure Example

```hcl
source "azure-arm" "windows" {
  client_id       = var.client_id
  client_secret   = var.client_secret
  subscription_id = var.subscription_id
  tenant_id       = var.tenant_id

  managed_image_resource_group_name = "images-rg"
  managed_image_name                = "windows-${local.timestamp}"

The rest: https://github.com/hashicorp/agent-skills/blob/HEAD/plugins/packer/skills/windows-builder/SKILL.md
