← 返回 Skills 市场
solomonneas

Hyperv Create Vm

作者 Solomon Neas · GitHub ↗ · v1.1.1 · MIT-0
cross-platform ⚠ suspicious
153
总下载
0
收藏
0
当前安装
4
版本数
在 OpenClaw 中安装
/install hyperv-create-vm
功能描述
Create Ubuntu 24.04 VMs on Windows Hyper-V from cloud images with cloud-init. Handles all the gotchas: sparse VHDX fix, hv_netvsc network config, permissions...
使用说明 (SKILL.md)

Hyper-V VM Creator

Create Ubuntu 24.04 VMs on Windows Hyper-V from cloud images with cloud-init. Returns a Docker-ready VM with SSH access.

When to Use

  • "create hyper-v vm"
  • "spin up vm on hyper-v"
  • "new hyper-v ubuntu vm"
  • Any time you need a fresh Linux VM on a Windows Hyper-V host

This is a base skill. It creates the VM. Other skills (soc-deploy-thehive, soc-deploy-misp) deploy applications onto it.

User Inputs

Parameter Default Required
VM name - Yes
Hyper-V host hyperv-host (YOUR_HYPERV_IP) No
CPU cores 2 No
RAM 4GB No
Disk 40GB No
VM user password (generated) No
Extra cloud-init packages - No
Network switch DNS-NIC-Switch No

Prerequisites Check

# SSH to Hyper-V host
ssh hyperv-host "echo OK" 2>/dev/null || echo "FAIL: Cannot SSH to Hyper-V host"

# qemu-img on Windows
ssh hyperv-host 'where "C:\Program Files\qemu\qemu-img.exe"' 2>/dev/null || echo "FAIL: qemu-img not installed (choco install qemu -y)"

# genisoimage on Linux (for building cloud-init ISO)
which genisoimage || echo "FAIL: genisoimage not installed (apt install genisoimage)"

Execution Flow

Step 1: Build cloud-init ISO (on Linux)

# Password via env var (recommended, avoids shell history/process list exposure)
VM_PASSWORD="\x3Cpassword>" bash scripts/build-cidata-iso.sh \x3Cvm-name> [ssh-public-key]

# Or via stdin
echo "\x3Cpassword>" | bash scripts/build-cidata-iso.sh \x3Cvm-name> [ssh-public-key]

# Creates /tmp/\x3Cvm-name>-cidata.iso

The ISO contains three files:

  • user-data: deploy user, Docker, Compose v2, SSH password auth
  • meta-data: instance-id and hostname
  • network-config: hv_netvsc DHCP match (CRITICAL for Hyper-V networking)

Step 2: Transfer files to Hyper-V host

# Cloud image (if not already cached)
wget -q https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img -O /tmp/ubuntu-24.04-cloud.img
scp /tmp/ubuntu-24.04-cloud.img hyperv-host:C:/Users/youruser/Downloads/

# Cloud-init ISO
scp /tmp/\x3Cvm-name>-cidata.iso hyperv-host:C:/Users/youruser/Downloads/

Step 3: Create VM (elevated PowerShell on Hyper-V host)

# Copy script to host
scp scripts/create-vm.ps1 hyperv-host:C:/Users/youruser/Downloads/

# Execute (needs elevation)
ssh hyperv-host "powershell -ExecutionPolicy Bypass -File C:\\Users\\youruser\\Downloads\\create-vm.ps1 \
  -VMName \x3Cvm-name> \
  -CloudInitISO C:\\Users\\youruser\\Downloads\\\x3Cvm-name>-cidata.iso \
  -DiskSizeGB \x3Cdisk> -MemoryGB \x3Cram> -CPUCount \x3Ccores>"

Step 4: Wait for boot and find IP

sleep 90  # Cloud-init needs ~90 seconds

# Hyper-V VMs have MACs starting with 00-15-5d
arp -a | grep "00-15-5d"

# Get VM MAC to match
ssh hyperv-host "powershell (Get-VMNetworkAdapter -VMName '\x3Cvm-name>').MacAddress"
# PowerShell shows: 00155D38010A
# ARP shows:        00-15-5d-38-01-0a

Step 5: Verify SSH and Docker

ssh deploy@\x3Cip> "docker --version && docker compose version && echo 'VM READY'"

Return Values

Report to caller:

VM Created: \x3Cvm-name>
IP: \x3Cip>
SSH: deploy@\x3Cip> (password: \x3Cpassword>)
Docker: installed
Docker Compose v2: installed

Teardown

To destroy a VM completely:

ssh hyperv-host "powershell -Command \"Stop-VM -Name '\x3Cvm-name>' -Force -TurnOff; Remove-VM -Name '\x3Cvm-name>' -Force; Remove-Item 'C:\\ProgramData\\Microsoft\\Windows\\Virtual Hard Disks\\\x3Cvm-name>.vhdx' -Force\""

Or use scripts/destroy-vm.ps1:

scp scripts/destroy-vm.ps1 hyperv-host:C:/Users/youruser/Downloads/
ssh hyperv-host "powershell -ExecutionPolicy Bypass -File C:\\Users\\youruser\\Downloads\\destroy-vm.ps1 -VMName \x3Cvm-name>"

Critical Gotchas

See references/gotchas.md for full details. Top blockers:

  1. Sparse VHDX: fsutil sparse setflag \x3Cpath> 0 BEFORE Resize-VHD or error 0xC03A001A
  2. Network config: Must include match: driver: hv_netvsc or VM gets no IP
  3. Permissions: icacls /grant "NT VIRTUAL MACHINE\Virtual Machines:(F)" or Start-VM fails
  4. Secure Boot Off: Ubuntu cloud images aren't signed for Hyper-V
  5. Cloud-init runs once: No redo. Delete VM + VHDX and start over
  6. Don't batch PowerShell: Run Hyper-V commands one at a time
  7. All commands need elevated PowerShell
  8. Docker Compose v2: Install via curl in runcmd, NOT apt
  9. IP discovery: Use ARP scan, not Get-VMNetworkAdapter (needs linux-tools-virtual)
安全使用建议
This skill appears to do what it says (create Hyper-V VMs) but has a few red flags you should address before running it against production hosts: - Review the PowerShell scripts (create-vm.ps1, destroy-vm.ps1, find-vm-ip.ps1) before use. They will be copied to and executed with elevated privileges on your Hyper-V host; their contents determine safety. The repository listing shows these scripts exist but their contents were not provided for review. - Fix/confirm the SSH-password behavior: SKILL.md and return values state a VM password will be returned, but the included cloud-init sets ssh_pwauth: false (disabling password login). Decide whether you want key-only access or password access and adjust the cloud-init template accordingly. - Use key-based SSH for the Hyper-V host where possible, and ensure the SSH user has only the required privileges. Be aware the automation requires Hyper-V admin privileges and will change VHDX files, permissions, and VM firmware settings. - Test in an isolated environment first (non-production Hyper-V host) to validate the full flow (image download, qemu-img conversion, fsutil sparse flag operations, Resize-VHD, permissions, VM boot and networking). - Correct the registry metadata glitch (shows [object Object]) so automated systems and operators see the required env vars accurately. If you provide the contents of the PowerShell scripts, I can re-evaluate with higher confidence.
功能分析
Type: OpenClaw Skill Name: hyperv-create-vm Version: 1.1.1 The skill bundle provides a legitimate and well-documented set of tools for automating Ubuntu VM creation on Windows Hyper-V. It follows security best practices by reading sensitive passwords via environment variables or stdin (scripts/build-cidata-iso.sh) and disabling password-based SSH authentication by default in the cloud-init configuration (scripts/cloud-init-user-data.yaml). The technical documentation in references/gotchas.md accurately addresses known Hyper-V automation challenges, such as sparse VHDX flags and specific network driver requirements, indicating a helpful and functional toolset without any signs of malicious intent or data exfiltration.
能力评估
Purpose & Capability
The name/description (create Ubuntu 24.04 VMs on Hyper-V with cloud-init) aligns with the declared requirements: SSH access to the Hyper-V host, Hyper-V admin privileges, genisoimage on the build host, and qemu-img on the Windows host. Requiring elevated rights on the Hyper-V host is expected for VM creation operations. The registry metadata has a small glitch ('Required env vars: [object Object]') but the SKILL.md clarifies the single optional VM_PASSWORD env var.
Instruction Scope
The runtime instructions ask the agent/operator to copy files to and execute elevated PowerShell remotely on the Windows host via SSH—this is expected for the task but is high-privilege and requires careful review. There is an important functional inconsistency: the skill promises a password for the 'deploy' user (and documents returning SSH password to caller), but the included cloud-init user-data sets 'ssh_pwauth: false' (disabling password auth). If callers expect password login this mismatch will cause failures or unexpected behavior. The build script also reads ~/.ssh/id_ed25519.pub by default (accesses the operator's public key file), which is reasonable but should be noted.
Install Mechanism
This is an instruction-only skill with no installer; it uses standard, traceable network resources (Ubuntu cloud images and a GitHub release for the Compose binary). The only required local tools are genisoimage (on the Linux build host) and qemu-img on the Windows host (suggested via choco). No arbitrary downloads from unknown personal servers are present in the provided files.
Credentials
The requested credentials (SSH access and Hyper-V admin rights) are high privilege but appropriate for creating VMs. The optional VM_PASSWORD env var is reasonable. However, the SKILL.md claims the skill will return and rely on an SSH password for the VM while the cloud-init snippet disables password auth—this mismatch undermines the stated credential usage. Also the registry metadata formatting bug (Required env vars: [object Object]) is an implementation inconsistency you should correct or validate.
Persistence & Privilege
The skill does not request always:true and has no install spec to persist code on the agent. It requires elevated actions on the remote Hyper-V host during execution but does not itself request permanent platform-level privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install hyperv-create-vm
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /hyperv-create-vm 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.1
Declared credential and tool requirements in frontmatter: SSH access, admin privileges, VM_PASSWORD env var, genisoimage, qemu-img. Fixes scanner flag for missing credential declarations.
v1.1.0
Security hardening: password now read from env var/stdin instead of CLI args (no process list exposure), SSH password auth disabled by default (key-only), Docker Compose version pinned to v2.32.4 instead of 'latest', added explicit file manifest to metadata
v1.0.1
Scrubbed personal info
v1.0.0
Initial release – automate Ubuntu 24.04 VM creation on Hyper-V with Docker ready: - Instantly creates Hyper-V VMs from cloud images with cloud-init, SSH, and Docker Compose v2 pre-installed. - Handles tricky details: sparse VHDX flags, hv_netvsc network config, VM permissions, Secure Boot, and cloud-init specifics. - Step-by-step process: builds cloud-init ISO, transfers files, PowerShell-driven VM creation, waits for boot, retrieves IP, and verifies Docker access. - Clearly describes all required inputs, prerequisites, and teardown instructions. - Lists critical "gotchas" and troubleshooting notes for reliable, repeatable automation.
元数据
Slug hyperv-create-vm
版本 1.1.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 4
常见问题

Hyperv Create Vm 是什么?

Create Ubuntu 24.04 VMs on Windows Hyper-V from cloud images with cloud-init. Handles all the gotchas: sparse VHDX fix, hv_netvsc network config, permissions... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 153 次。

如何安装 Hyperv Create Vm?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install hyperv-create-vm」即可一键安装,无需额外配置。

Hyperv Create Vm 是免费的吗?

是的,Hyperv Create Vm 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Hyperv Create Vm 支持哪些平台?

Hyperv Create Vm 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Hyperv Create Vm?

由 Solomon Neas(@solomonneas)开发并维护,当前版本 v1.1.1。

💬 留言讨论