How to create a program in creating a multiple virtual machines and run a script in powershell?

Anonymous
2024-07-09T01:03:44+00:00

I have a difficulty in creating a program in creating a multiple VMs in windows server. I should run a script in powershell to create VMs.

Windows Server High availability

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Anonymous
    2024-07-10T01:33:06+00:00

    Hi masterram95,

    If you have already added the Hyper-V role to the Windows Server, you can create Hyper-V VMs using the New-VM cmdlet in Windows PowerShell. Open Windows PowerShell as administrator and run a command like below.

    Example 1

    New-VM -Name "new 1" -MemoryStartupBytes 512MB
    

    This example creates a new virtual machine named new 1 that has 512 MB of memory.

    Example 2

    New-VM -Name "new 2" -MemoryStartupBytes 1GB -NewVHDPath d:\vhd\base.vhdx -NewVHDSizeBytes 40GB
    

    This example creates a virtual machine named new 2 that has 1 GB of memory and that is connected to a new 40 GB virtual hard disk that uses the VHDX format.

    You can either run the command in a PowerShell window directly or save it as a .PS1 script file.

    Please refer to this link for more details about the New-VM cmdlet.

    New-VM (Hyper-V) | Microsoft Learn

    0 comments No comments