Created
September 7, 2019 03:50
-
-
Save andy51002000/94ed9bade2da2f6c82f8908e6c8db50c to your computer and use it in GitHub Desktop.
Quick Create 3 VM on Hyper V
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VM_PATH='C:\Users\andy5100\Documents\export\ubuntu\ubuntu-pure\Virtual Machines\1B241D9D-7353-4977-B759-F7E0C1A126DC.vmcx' | |
$VM_DEST_MASTER='C:\Users\andy5100\Documents\k8s2\master' | |
$VM_DEST_NODE1='C:\Users\andy5100\Documents\k8s2\node1' | |
$VM_DEST_NODE2='C:\Users\andy5100\Documents\k8s2\node2' | |
$VM_DEST_LIST=@($VM_DEST_MASTER, $VM_DEST_NODE1, $VM_DEST_NODE2) | |
foreach ( $DEST in $VM_DEST_LIST) { | |
If(!(test-path $DEST)) { | |
New-Item -ItemType Directory -Force -Path $DEST | |
echo "Desternation is not existing, create a new one $DEST" | |
} | |
echo "Strat to copy a vm to $DEST" | |
Import-VM -Path $VM_PATH -Copy -GenerateNewId -VhdDestinationPath $DEST -VirtualMachinePath $DEST | |
echo "Done!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment