mirror of
https://github.com/Grace-Solutions/PSProxmox.git
synced 2026-08-11 23:56:54 +00:00
Add padded counter and AutoSMBIOS parameters to New-ProxmoxVMFromTemplate
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# Advanced-MultipleVMsWithPaddedCounters.ps1
|
||||
# This script demonstrates how to create multiple VMs with padded counters and automatic SMBIOS settings.
|
||||
|
||||
# Import the PSProxmox module
|
||||
Import-Module PSProxmox
|
||||
|
||||
# Connect to the Proxmox VE server
|
||||
$credential = Get-Credential -Message "Enter your Proxmox VE credentials"
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential $credential -Realm "pam"
|
||||
|
||||
# Method 1: Create multiple VMs with padded counters
|
||||
$vms = New-ProxmoxVMFromTemplate -Connection $connection -Node "pve1" -TemplateName "Ubuntu-Template" `
|
||||
-Prefix "web-" -Count 3 -CounterDigits 3 -Start
|
||||
|
||||
# Display the VM information
|
||||
Write-Host "Created VMs with padded counters:"
|
||||
$vms | Select-Object Name, VMID, Status | Format-Table
|
||||
|
||||
# Method 2: Create multiple VMs with padded counters and custom starting index
|
||||
$vms = New-ProxmoxVMFromTemplate -Connection $connection -Node "pve1" -TemplateName "Ubuntu-Template" `
|
||||
-Prefix "db-" -Count 2 -StartIndex 10 -CounterDigits 4 -Memory 4096 -Cores 2 -Start
|
||||
|
||||
# Display the VM information
|
||||
Write-Host "Created VMs with padded counters and custom starting index:"
|
||||
$vms | Select-Object Name, VMID, Status | Format-Table
|
||||
|
||||
# Method 3: Create multiple VMs with automatic SMBIOS settings
|
||||
$vms = New-ProxmoxVMFromTemplate -Connection $connection -Node "pve1" -TemplateName "Windows-Template" `
|
||||
-Prefix "win-" -Count 3 -CounterDigits 2 -AutomaticSMBIOS -SMBIOSProfile "Dell" -Start
|
||||
|
||||
# Display the VM information
|
||||
Write-Host "Created VMs with Dell SMBIOS settings:"
|
||||
$vms | Select-Object Name, VMID, Status | Format-Table
|
||||
|
||||
# Method 4: Create multiple VMs with different SMBIOS profiles
|
||||
$manufacturers = @("Dell", "HP", "Lenovo", "Microsoft")
|
||||
$count = $manufacturers.Count
|
||||
|
||||
$vms = New-ProxmoxVMFromTemplate -Connection $connection -Node "pve1" -TemplateName "Windows-Template" `
|
||||
-Prefix "test-" -Count $count -CounterDigits 2 -Start
|
||||
|
||||
# Update each VM with a different SMBIOS profile
|
||||
for ($i = 0; $i -lt $count; $i++) {
|
||||
$profile = $manufacturers[$i]
|
||||
$vmid = $vms[$i].VMID
|
||||
|
||||
Write-Host "Setting $profile SMBIOS profile for VM $vmid..."
|
||||
Set-ProxmoxVMSMBIOS -Connection $connection -Node "pve1" -VMID $vmid -UseProfile -Profile $profile
|
||||
}
|
||||
|
||||
# Display the VM information
|
||||
Write-Host "Created VMs with different SMBIOS profiles:"
|
||||
$vms | Select-Object Name, VMID, Status | Format-Table
|
||||
|
||||
# Disconnect from the server when done
|
||||
Disconnect-ProxmoxServer -Connection $connection
|
||||
Reference in New Issue
Block a user