Skip to content

A Powershell script for applying a linux cloudinit network-config file to a windows VM

License

Notifications You must be signed in to change notification settings

cycleplatform/windows-vm-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cycle Windows VM Metadata Apply Script

cycle

A collection of PowerShell scripts for applying a Linux-style cloud-init configuration to a Windows VM on Cycle.

Running Scripts Inside a Cycle Windows VM

Cycle automatically attaches a config-drive to every VM during provisioning. This drive contains metadata including:

  • user-data
  • meta-data
  • network-config

To run these scripts inside the VM:

1. Use an attachment to mount the ISO containing this script into the VM.

It will most likely be available under the F:\ drive, but may be different for you.

2. Connect to the VM using VNC in the Cycle Portal

Open the VM in the Cycle Portal and use the built-in VNC console to connect and log in.

3. Open PowerShell

Right-click Start → Windows PowerShell.

4. Run the selected script

F:\netconf-apply.ps1

Expected output example:

[Cycle] Applying network configuration...
[Cycle] Found network-config on D:
[Cycle] Nics in YAML:
  Key=eth0 MAC=xx:xx:xx:xx:xx:xx Name=Ethernet
  Key=eth1 MAC=xx:xx:xx:xx:xx:xx Name=Ethernet 2
...
[Cycle] Network configuration applied successfully.

Network Configuration Script

netconf-apply.ps1

This script reads the Linux-style network-config file from the VM’s config-drive and applies the full network setup to Windows. It parses the YAML, matches adapters by MAC address, renames NICs if specified, and configures IPv4/IPv6 addresses, routes, DNS, and MTU values using netsh.

Setup task on windows boot

Setup a windows scheduled task to always run netconf-apply on system boot.

F:\netconf-apply-onboot.ps1

This will add a cycleio directory and script on your systemdrive along with a scheduled task to always apply netconf-apply.ps1 on system startup. This is recommended as networking configuration can change between stopping and starting your VM.

About

A Powershell script for applying a linux cloudinit network-config file to a windows VM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •