This is a script to quickly create a VM, mostly for tests
Quickly create a VM with 512MB Ram on local Hyper-V host
[sourcecode language=”powershell”]
New-VM -Name testvm01 -Path ‘C:VMs’ -MemorystartupBytes 512MB
[/sourcecode]
Quickly create a VM with 512MB Ram on remote Hyper-V host
[sourcecode language=”powershell”]
New-VM -Computername ‘hypervhostname’ -Name ‘vmname’ -Path ‘c:VMs’ -MemorystartupBytes 512MB
[/sourcecode]
Create multiple VMs on a remote host using a list.
Create a txt file with VM names, like this:
name
testvm01
testvm02
testvm03
The command:
[sourcecode language=”powershell”]
Import-Csv C:list.txt | foreach { New-VM -ComputerName ‘hypervhost’ -Name $_.name -Path ‘c:VMs’ -MemorystartupBytes 512MB}
[/sourcecode]
Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.