-
Notifications
You must be signed in to change notification settings - Fork 32
Home
graememeyer edited this page Jan 25, 2020
·
8 revisions
Welcome to the vmxtoolkit wiki!
vmxtoolkit is a set of PowerShell commands using the VIX API for creating and controlling new VMs from clones and linked clones.
Besides creating snaps and clones, a lot of additional helpers are added to modify a VM´s configuration, like adding and changing NICs and Networks, changing memory and CPU and many other things.
Most of the commands expect the VMto be offline.
A typical clone Sequence might be:
- Identify a base snapshot
- Create a linked clone from the base snapshot
- Rename the displayname of the VM ( Default is clone of... )
- Adjust Network settings/configuration
- Start the VM
Example:
### Select the 'base' snapshot of a VM and if necessary create it
$MasterVMX = get-vmx -path .\Server2012Master
$Basesnap = $MasterVMX | Get-VMXSnapshot | where Snapshot -Match "Base"
if (!$Basesnap)
{
Write-verbose "Base snap does not exist, creating now"
$Basesnap = $MasterVMX | New-VMXSnapshot -SnapshotName Base
}
### Clone the 'base' snapshot into a new $NodeClone object
$NodeClone = $MasterVMX | Get-VMXSnapshot | where Snapshot -Match "Base" | New-VMXLinkedClone -CloneName MyClone
### Add some Disks
foreach ($LUN in (1..3))
{
$Diskname = "SCSI0"+"_LUN$LUN"+"_$Disksize.vmdk"
$Newdisk = $Nodeclone | New-VMXScsiDisk -NewDiskSize $Disksize -NewDiskname $Diskname
$AddDisk = $NodeClone | Add-VMXScsiDisk -Diskname $Newdisk.Diskname -LUN $LUN -Controller $SCSI
}
### Connect Custom Network
$Netadapter = $Nodeclone | Set-VMXNetworkAdapter -Adapter 0 -ConnectionType custom -AdapterType vmxnet3
$Net = $Nodeclone | Set-VMXVnet -Adapter 0 -vnet $vmnet -config $NodeClone.Config | Out-Null
### Configure the display name
$Displayname = $NodeClone | Set-VMXDisplayName -DisplayName "WindowsDev"
###
$MainMem = $NodeClone | Set-VMXMainMemory -usefile:$false # uses Windows swap insted of a VM File
$Scenario = $NodeClone |Set-VMXscenario -Scenarioname WinDev -Scenario 7
$ActivationPrefrence = $NodeClone |Set-VMXActivationPreference -activationpreference 1
### Start the newly cloned and configured VM
$Nodeclone | start-vmx
Available commands:
PS E:\GitHub> Get-Command -Module vmxtoolkit
CommandType Name Version Source
----------- ---- ------- ------
Function Add-VMXScsiDisk 4.5.3.1 vmxtoolkit
Function Connect-VMXcdromImage 4.5.3.1 vmxtoolkit
Function Connect-VMXNetworkAdapter 4.5.3.1 vmxtoolkit
Function Convert-VMXdos2unix 4.5.3.1 vmxtoolkit
Function Copy-VMXDirHost2Guest 4.5.3.1 vmxtoolkit
Function Copy-VMXFile2Guest 4.5.3.1 vmxtoolkit
Function Copy-VMXFile2Host 4.5.3.1 vmxtoolkit
Function Disconnect-VMXNetworkAdapter 4.5.3.1 vmxtoolkit
Function Expand-VMXDiskfile 4.5.3.1 vmxtoolkit
Function Get-VMwareVersion 4.5.3.1 vmxtoolkit
Function Get-VMX 4.5.3.1 vmxtoolkit
Function Get-VMXActivationPreference 4.5.3.1 vmxtoolkit
Function Get-VMXAnnotation 4.5.3.1 vmxtoolkit
Function Get-VMXConfig 4.5.3.1 vmxtoolkit
Function Get-VMXConfigVersion 4.5.3.1 vmxtoolkit
Function Get-VMXDisplayName 4.5.3.1 vmxtoolkit
Function Get-VMXGuestOS 4.5.3.1 vmxtoolkit
Function Get-VMXHWVersion 4.5.3.1 vmxtoolkit
Function Get-VMXIdeDisk 4.5.3.1 vmxtoolkit
Function Get-VMXInfo 4.5.3.1 vmxtoolkit
Function Get-VMXIPAddress 4.5.3.1 vmxtoolkit
Function Get-VMXmemory 4.5.3.1 vmxtoolkit
Function Get-VMXNetwork 4.5.3.1 vmxtoolkit
Function Get-VMXNetworkAdapter 4.5.3.1 vmxtoolkit
Function Get-VMXNetworkAdapterDisplayName 4.5.3.1 vmxtoolkit
Function Get-VMXNetworkAddress 4.5.3.1 vmxtoolkit
Function Get-VMXNetworkConnection 4.5.3.1 vmxtoolkit
Function Get-VMXProcessesInGuest 4.5.3.1 vmxtoolkit
Function Get-VMXProcessor 4.5.3.1 vmxtoolkit
Function Get-VMXRun 4.5.3.1 vmxtoolkit
Function Get-VMXscenario 4.5.3.1 vmxtoolkit
Function Get-VMXScsiController 4.5.3.1 vmxtoolkit
Function Get-VMXScsiDisk 4.5.3.1 vmxtoolkit
Function Get-VMXsharedFolder 4.5.3.1 vmxtoolkit
Function Get-VMXSnapshot 4.5.3.1 vmxtoolkit
Function Get-VMXSnapshotconfig 4.5.3.1 vmxtoolkit
Function Get-VMXTemplate 4.5.3.1 vmxtoolkit
Function Get-VMXToolsState 4.5.3.1 vmxtoolkit
Function Get-VMXUUID 4.5.3.1 vmxtoolkit
Function Get-VMXVariable 4.5.3.1 vmxtoolkit
Function Get-VMXVTBit 4.5.3.1 vmxtoolkit
Function Get-yesno 4.5.3.1 vmxtoolkit
Function Get-yesnoabort 4.5.3.1 vmxtoolkit
Function Import-VMXOVATemplate 4.5.3.1 vmxtoolkit
Function Invoke-VMXBash 4.5.3.1 vmxtoolkit
Function Invoke-VMXexpect 4.5.3.1 vmxtoolkit
Function Invoke-VMXPowerShell 4.5.3.1 vmxtoolkit
Function Invoke-VMXScript 4.5.3.1 vmxtoolkit
Function New-VMX 4.5.3.1 vmxtoolkit
Function New-VMXClone 4.5.3.1 vmxtoolkit
Function New-VMXGuestPath 4.5.3.1 vmxtoolkit
Function New-VMXLinkedClone 4.5.3.1 vmxtoolkit
Function New-VMXScsiDisk 4.5.3.1 vmxtoolkit
Function New-VMXSnapshot 4.5.3.1 vmxtoolkit
Function Optimize-VMXDisk 4.5.3.1 vmxtoolkit
Function Remove-vmx 4.5.3.1 vmxtoolkit
Function Remove-VMXScsiDisk 4.5.3.1 vmxtoolkit
Function Remove-VMXserial 4.5.3.1 vmxtoolkit
Function Remove-VMXSnapshot 4.5.3.1 vmxtoolkit
Function Repair-VMXDisk 4.5.3.1 vmxtoolkit
Function Resize-VMXDiskfile 4.5.3.1 vmxtoolkit
Function Restore-VMXSnapshot 4.5.3.1 vmxtoolkit
Function Search-VMXPattern 4.5.3.1 vmxtoolkit
Function Set-VMXActivationPreference 4.5.3.1 vmxtoolkit
Function Set-VMXAnnotation 4.5.3.1 vmxtoolkit
Function Set-VMXDisconnectIDE 4.5.3.1 vmxtoolkit
Function Set-VMXDisplayName 4.5.3.1 vmxtoolkit
Function Set-VMXDisplayScaling 4.5.3.1 vmxtoolkit
Function Set-VMXGuestOS 4.5.3.1 vmxtoolkit
Function Set-VMXHWversion 4.5.3.1 vmxtoolkit
Function Set-VMXIDECDrom 4.5.3.1 vmxtoolkit
Function Set-VMXLinuxDNS 4.5.3.1 vmxtoolkit
Function Set-VMXLinuxNetwork 4.5.3.1 vmxtoolkit
Function Set-VMXMainMemory 4.5.3.1 vmxtoolkit
Function Set-VMXmemory 4.5.3.1 vmxtoolkit
Function Set-VMXnestedHVEnabled 4.5.3.1 vmxtoolkit
Function Set-VMXNetworkAdapter 4.5.3.1 vmxtoolkit
Function Set-VMXprocessor 4.5.3.1 vmxtoolkit
Function Set-VMXScenario 4.5.3.1 vmxtoolkit
Function Set-VMXScsiController 4.5.3.1 vmxtoolkit
Function Set-VMXserialPipe 4.5.3.1 vmxtoolkit
Function Set-VMXSharedFolder 4.5.3.1 vmxtoolkit
Function Set-VMXSharedFolderState 4.5.3.1 vmxtoolkit
Function Set-VMXSize 4.5.3.1 vmxtoolkit
Function Set-VMXTemplate 4.5.3.1 vmxtoolkit
Function Set-VMXToolsReminder 4.5.3.1 vmxtoolkit
Function Set-VMXUUID 4.5.3.1 vmxtoolkit
Function Set-VMXVnet 4.5.3.1 vmxtoolkit
Function Set-VMXVTBit 4.5.3.1 vmxtoolkit
Function Start-VMX 4.5.3.1 vmxtoolkit
Function Stop-VMX 4.5.3.1 vmxtoolkit
Function Suspend-VMX 4.5.3.1 vmxtoolkit
Function Test-VMXFileInGuest 4.5.3.1 vmxtoolkit
Function Wait-VMXuserloggedIn 4.5.3.1 vmxtoolkit