Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/UsefulScripts01/PSHyperVTemplate
Create Hyper-V virtual machines from XML templates
https://github.com/UsefulScripts01/PSHyperVTemplate
hyper-v powershell virtual-machine xml
Last synced: 3 months ago
JSON representation
Create Hyper-V virtual machines from XML templates
- Host: GitHub
- URL: https://github.com/UsefulScripts01/PSHyperVTemplate
- Owner: UsefulScripts01
- Created: 2023-01-28T21:19:45.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-20T12:04:49.000Z (over 1 year ago)
- Last Synced: 2024-05-11T04:36:17.726Z (6 months ago)
- Topics: hyper-v, powershell, virtual-machine, xml
- Language: PowerShell
- Homepage:
- Size: 66.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - UsefulScripts01/PSHyperVTemplate - Create Hyper-V virtual machines from XML templates (PowerShell)
README
## PSHyperVTemplate
### Create Hyper-V virtual machines from XML templates.
### Installation
Copy the code from the area below and paste it into PowerShell Admin (or Windows Terminal).
```powershell
Install-Module -Name PSHyperVTemplate
Import-Module -Name PSHyperVTemplate
```
### Default settings for a new machine
The default settings for a new VM are stored in `"C:\Temp\VmTemplates\DefaultTemplate.xml"`. Copy this file to create additional templates.
```xml
VM
2
0
8
1
16
4
1
100
C:\Users\Public\Documents\Hyper-V\Virtual hard disks\
C:\MDT\Boot\LiteTouchPE_x64.iso
Default Switch
0
0
0```
### Parameters
You can define your own parameter values or use the predefined ones from the VmTemplate.xml file.
`-Template` - [string] Chose XML template to use \
`-Name` - [string] Name of a new machne (default is "VM_no") \
`-Generation` - [string] Generation of a new machine (1 or 2, default is 2) \
`-ISO` - [string] Boot ISO file path \
`-Start` - [switch] Start the machine after creation \
`-RunManager` - [switch] Run Hyper-V Manager
### Examples
Example 1: Simple, all parameters from the DefaultTemplate.xml.
```powershell
New-Vmachine
```
Example 2: Generation 2. Start after creation.
```powershell
New-Vmachine -Generation 2 -Start
```
Example 3: Generation 1. Use the "Linux.xml" template file..
```powershell
New-Vmachine -Generation 1 -Template "Linux"
```
Example 4: Generation 1, boot from the ISO file defined in the parameter.
```powershell
New-Vmachine -Generation 1 -Name "MachineName" -ISO "C:\installation.iso"
```
Example 5: Remove selected machine.
```powershell
Remove-Vmachine -Name "MachineName"
```