Created
July 9, 2021 16:48
-
-
Save mjfusa/b07e597fe2a6496b90eb9ffc9989340a to your computer and use it in GitHub Desktop.
Create VM with iso OS
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
Param( | |
[Parameter(Mandatory=$true)] | |
$VMName, | |
[Parameter(Mandatory=$true)] | |
$Memory, | |
[Parameter(Mandatory=$true)] | |
$NewVHD, | |
[Parameter(Mandatory=$true)] | |
$VHDSize, | |
$Switch='Default Switch', | |
$Cpu=2, | |
[Parameter(Mandatory=$true)] | |
$IsoPath | |
) | |
New-VM -Name $VMName –NewVHDPath $NewVHD -MemoryStartupBytes $Memory -NewVHDSizeBytes $VHDSize | |
ADD-VMNetworkAdapter –VMName $VMName –Switchname $Switch | |
SET-VMProcessor –VMName $VMName –Count 2 | |
Set-VMDvdDrive -VMName $VMName -ControllerNumber 1 -Path $IsoPath | |
#New-VM -Name "vs vm" –NewVHDPath 'D:\Hyper-V\Virtual Hard Disks\vsvm.vhdx' -MemoryStartupBytes 1GB -NewVHDSizeBytes 40GB | |
#ADD-VMNetworkAdapter –VMName 'vs vm' –Switchname "Default Switch" | |
#SET-VMProcessor –VMName “vs vm” –Count 2 | |
#Set-VMDvdDrive -VMName 'vs vm' -ControllerNumber 1 -Path "D:\iso\Windows.iso" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment