This seems impossible, no matter what you do. You can't connect via powershell to the cluster and deploy VMs there. You end up in a loophole deploying new VMs in stand alone variants if you run "New-VM -Name FUCKEDUPSHIT"
The trick is to run everything as normal, I use the cluster namespace to randomly use an active host to deploy VM.
This is pieces needed to deploy a VM:
# Set VM-variables
$vmName = 'FUCKEDUPSHIT'
# Set login information
$passwd = ConvertTo-SecureString <YOUR-SECRET-PASSWORD> -AsPlainText -Force
$localAccount = 'domain\user'
$pscredential = New-Object System.Management.Automation.PSCredential($localAccount, $passwd.Copy())
Enter-PSSession -ComputerName <YOUR-CLUSTER-FQDN>
New-VM -Name $vmName
# Then the magic mostly undocumented oneliner to move the standalone VM to a failover VM
# Set the VM to HA/Failover
Get-VM -Name $vmName | Add-ClusterVirtualMachineRole
Celebrate with a beer...or two!
Kommentarer
Skicka en kommentar