adding UEFI Disk layout support
This commit is contained in:
parent
3c1ef25cb5
commit
6137587795
@ -27,5 +27,8 @@ Add Unattend answer file
|
|||||||
Add VirtIO Drivers
|
Add VirtIO Drivers
|
||||||
.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -VirtIOPath <path>\virtio.iso
|
.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -VirtIOPath <path>\virtio.iso
|
||||||
|
|
||||||
|
Add UEFI Disk format support
|
||||||
|
.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -disklayout UEFI (if not specified Default will be bios)
|
||||||
|
|
||||||
All Commands Usage
|
All Commands Usage
|
||||||
.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -feature <featuretoenable> -UnattendPath <path>\unattend.xml -DriversPath <path to drivers folder> -CloudbaseInitMsiUrl < your cloudbaseinit msi url> -baudrate <value> -OutputFormat vhd/qcow2 (Default will be vhd)
|
.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -feature <featuretoenable> -UnattendPath <path>\unattend.xml -DriversPath <path to drivers folder> -CloudbaseInitMsiUrl < your cloudbaseinit msi url> -baudrate <value> -OutputFormat vhd/qcow2 (if not specified Default will be vhd) -disklayout UEFI (if not specified Default will be bios)
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
#.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -VirtIOPath <path>\virtio.iso
|
#.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -VirtIOPath <path>\virtio.iso
|
||||||
|
|
||||||
# All Commands Usage
|
# All Commands Usage
|
||||||
#.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -feature <featuretoenable> -UnattendPath <path>\unattend.xml -DriversPath <path to drivers folder> -baudrate <value> -OutputFormat vhd/qcow2 (Default will be vhd)
|
#.\diskimagebuilder.ps1 -SourceFile <path>\install.wim -VHDFile <path>\VHDFilename -VHDSize <size of vhd> -feature <featuretoenable> -UnattendPath <path>\unattend.xml -DriversPath <path to drivers folder>
|
||||||
|
|
||||||
|
# Please download and install qemu binary for getting qcow2 format of image from the link --> http://qemu.weilnetz.de/w64/
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
[Parameter(mandatory=$True,HelpMessage="Name and path of Sourcefile (WIM).")]
|
[Parameter(mandatory=$True,HelpMessage="Name and path of Sourcefile (WIM).")]
|
||||||
@ -65,6 +67,10 @@ Param(
|
|||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[String]$OutputFormat,
|
[String]$OutputFormat,
|
||||||
|
|
||||||
|
[parameter(HelpMessage="UEFI Disk layout")]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$disklayout,
|
||||||
|
|
||||||
[parameter(HelpMessage="Add Drivers From Virtio ISO.")]
|
[parameter(HelpMessage="Add Drivers From Virtio ISO.")]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[String]$VirtIOPath
|
[String]$VirtIOPath
|
||||||
@ -202,7 +208,12 @@ function CreateThrwDiskpart(){
|
|||||||
$GB = [System.UInt64] $VHDSize*1024
|
$GB = [System.UInt64] $VHDSize*1024
|
||||||
$path = $vhdFile
|
$path = $vhdFile
|
||||||
$script = "create VDISK FILE=`"$path`" maximum=`"$GB`" type=expandable `r`nselect VDISK FILE=`"$path`"`r`nattach VDISK`r`ncreate partition primary`r`nassign letter=`"$VHDVolume`"`r`nformat fs=ntfs quick label=vhd`r`nactive`r`nexit"
|
$script = "create VDISK FILE=`"$path`" maximum=`"$GB`" type=expandable `r`nselect VDISK FILE=`"$path`"`r`nattach VDISK`r`ncreate partition primary`r`nassign letter=`"$VHDVolume`"`r`nformat fs=ntfs quick label=vhd`r`nactive`r`nexit"
|
||||||
$script | DISKPART
|
$gptscript = "create VDISK FILE=`"$path`" maximum=`"$GB`" type=expandable `r`nselect VDISK FILE=`"$path`"`r`nattach VDISK`r`convert gpt`r`ncreate partition primary`r`nassign letter=`"$VHDVolume`"`r`nformat fs=ntfs quick label=vhd`r`nexit"
|
||||||
|
if($disklayout){
|
||||||
|
$gptscript | DISKPART
|
||||||
|
}else{
|
||||||
|
$script | DISKPART
|
||||||
|
}
|
||||||
$VHDVolume = [string]$VHDVolume + ":"
|
$VHDVolume = [string]$VHDVolume + ":"
|
||||||
Write-W2VInfo " $VHDVolume is the drive letter"
|
Write-W2VInfo " $VHDVolume is the drive letter"
|
||||||
dism.exe /apply-Image /ImageFile:$SourceFile /index:$Index /ApplyDir:$VHDVolume\
|
dism.exe /apply-Image /ImageFile:$SourceFile /index:$Index /ApplyDir:$VHDVolume\
|
||||||
@ -373,6 +384,7 @@ if($OutputFormat){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Write-W2VInfo "================= Please check logs directory for Image creation log files. ===================="
|
||||||
Write-W2VInfo "================= Completed Image Creation and ready. ======================="
|
Write-W2VInfo "================= Completed Image Creation and ready. ======================="
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user