This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
diskimagescript-usage [2014/08/22 18:23] gsamfira |
diskimagescript-usage [2014/08/26 19:14] (current) anashwan Updated Wiki |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| # Using the Diskimage-Builder PowerShell script | # Using the Diskimage-Builder PowerShell script | ||
| - | This page thoroughly documents the use of [this](https:// | + | This page thoroughly documents the use of [this](https:// |
| ## Prerequisites: | ## Prerequisites: | ||
| Line 8: | Line 8: | ||
| #### Start a PowerShell session from _cmd_: | #### Start a PowerShell session from _cmd_: | ||
| ``` | ``` | ||
| - | start powershell | + | > start powershell |
| ``` | ``` | ||
| Line 14: | Line 14: | ||
| #### Download and install _git_: | #### Download and install _git_: | ||
| ``` | ``` | ||
| - | (New-Object System.Net.WebClient).DownloadFile(" | + | PS> |
| - | cmd.exe /C call $HOME\Git-1.9.0-preview20140217.exe /SILENT | + | PS> |
| ``` | ``` | ||
| #### For _qcow2 conversion support_, download and install the latest _qemu_ tools(as of the making of this article, build date 08.01.2014): | #### For _qcow2 conversion support_, download and install the latest _qemu_ tools(as of the making of this article, build date 08.01.2014): | ||
| ``` | ``` | ||
| - | (New-Object System.Net.WebClient).DownloadFile(" | + | PS> |
| - | cmd.exe /C call $HOME\qemu-w64-setup-20140801.exe /SILENT | + | PS> |
| ``` | ``` | ||
| #### Add all dependencies to path, both to the environment variable and for the current session: | #### Add all dependencies to path, both to the environment variable and for the current session: | ||
| ``` | ``` | ||
| - | $newPath = " | + | PS> |
| - | $env:Path = $newPath | + | PS> |
| - | setx PATH $newPath | + | PS> |
| ``` | ``` | ||
| Line 34: | Line 34: | ||
| ## Getting the script: | ## Getting the script: | ||
| ``` | ``` | ||
| - | cd $HOME | + | PS> |
| - | git clone https:// | + | PS> |
| ``` | ``` | ||
| Line 43: | Line 43: | ||
| #### Start a new PowerShell session as administrator: | #### Start a new PowerShell session as administrator: | ||
| ``` | ``` | ||
| - | Start-Process PowerShell -Verb RunAs | + | PS> |
| ``` | ``` | ||
| Line 49: | Line 49: | ||
| ### Getting at the _.wim_ file of an _.iso_: | ### Getting at the _.wim_ file of an _.iso_: | ||
| ``` | ``` | ||
| - | $mountpoint = Mount-DiskImage -ImagePath C: | + | PS> |
| - | $wimfilePath = ($mountpoint | Get-Volume).DriveLetter + ": | + | PS> |
| # AFTER succesfully using the .wim in the script, don't forget to dismount the .iso: | # AFTER succesfully using the .wim in the script, don't forget to dismount the .iso: | ||
| - | Dismount-DiskImage -ImagePath C: | + | PS> |
| ``` | ``` | ||
| - | ### Creating a _.vhd_: | + | ### Creating a _.vhd_ |
| + | |||
| + | * **Note**: For _.vhdx_ output, simply provide a VHDFile name with the _.vhdx_ extension. | ||
| ``` | ``` | ||
| - | cd $HOME\windows-diskimage-builder\windows-diskimage-builder | + | PS> |
| # previous steps for obtaining the $wimfilePath are assumed to have been done | # previous steps for obtaining the $wimfilePath are assumed to have been done | ||
| - | .\diskimagebuilder.ps1 -SourceFile $wimfilePath -VHDFile $HOME\resultingDiskImage.vhd -VHDSize 16 | + | PS> |
| ``` | ``` | ||
| * *Notes:* | * *Notes:* | ||
| Line 69: | Line 71: | ||
| ### Creating a _.qcow2_: | ### Creating a _.qcow2_: | ||
| ``` | ``` | ||
| - | .\diskimagebuilder.ps1 -SourceFile $wimfilePath -VHDFile $HOME\resultingDiskImage.vhd -VHDSize 16 -OutputFormat qcow2 | + | PS> |
| ``` | ``` | ||
| * **Notes:** | * **Notes:** | ||
| + | * If operating on _qcow2_' | ||
| * Even when creating a _.qcow2_, the name of the resulting file **must have the .vhd extension**, | * Even when creating a _.qcow2_, the name of the resulting file **must have the .vhd extension**, | ||
| * After the execution of the script, the result will indeed be a _.qcow2_ as the script puts the proper extension towards the end of its execution. | * After the execution of the script, the result will indeed be a _.qcow2_ as the script puts the proper extension towards the end of its execution. | ||
| Line 83: | Line 86: | ||
| ## Script parameters and options: | ## Script parameters and options: | ||
| - | * -SourceFile C: | + | * **-SourceFile** C: |
| * absolute path to the .wim file which will be used as input. | * absolute path to the .wim file which will be used as input. | ||
| - | * -VHDFile C: | + | * **-VHDFile** C: |
| * absolute path to the script' | * absolute path to the script' | ||
| * must have the .vhd extension initially, even when creating a _qcow2_. | * must have the .vhd extension initially, even when creating a _qcow2_. | ||
| * if _qcow2_ is selected, output' | * if _qcow2_ is selected, output' | ||
| * represents the **exact** path to the output file, **which must NOT exist beforehand**. | * represents the **exact** path to the output file, **which must NOT exist beforehand**. | ||
| - | * -VHDSize 16 | + | * **-VHDSize** 16 |
| * maximum size in GB of the resulting vhd/qcow2 image | * maximum size in GB of the resulting vhd/qcow2 image | ||
| * for most Windows installations, | * for most Windows installations, | ||
| * all output disks are resizeable, so initial size of output may be a lot less than this value. | * all output disks are resizeable, so initial size of output may be a lot less than this value. | ||
| - | * -CloudbaseInitMsiUrl http:// | + | * **-CloudbaseInitMsiUrl** http:// |
| * link to the CloudBaseInit.msi that is to be added to the image. | * link to the CloudBaseInit.msi that is to be added to the image. | ||
| * default is http:// | * default is http:// | ||
| * the .msi together with a .cmd to execute it are put in the resulting disk under Disk: | * the .msi together with a .cmd to execute it are put in the resulting disk under Disk: | ||
| - | * -UnattendedPath C: | + | * **-UnattendedPath** C: |
| * path to the .xml file which is to be used in unattended mode. | * path to the .xml file which is to be used in unattended mode. | ||
| * default is the Unattended.mxl that can be found right beside the script. | * default is the Unattended.mxl that can be found right beside the script. | ||
| * the .xml file is placed directly in the root directory of the created image. | * the .xml file is placed directly in the root directory of the created image. | ||
| - | * -DriversPath | + | * **-DriversPath** C: |
| * path to a folder containing drivers that are to be added to the disk. | * path to a folder containing drivers that are to be added to the disk. | ||
| * default is none, in which case no additional drivers will be added to the disk image. | * default is none, in which case no additional drivers will be added to the disk image. | ||
| - | * -VirtIOPath C: | + | * **-VirtIOPath** C: |
| * path to a VirtIO _.iso_ from which VirtIO drivers mean to be installed. | * path to a VirtIO _.iso_ from which VirtIO drivers mean to be installed. | ||
| * default is none, in which case no additional drivers will be installed to the disk image. | * default is none, in which case no additional drivers will be installed to the disk image. | ||
| - | * -Feature feature | + | * **-Feature feature** |
| * feature to be enabled in the final disk image (ex: TFTP, IIS-WebServer, | * feature to be enabled in the final disk image (ex: TFTP, IIS-WebServer, | ||
| * this script only specifically enables one feature per image, the default being none. | * this script only specifically enables one feature per image, the default being none. | ||
| * the feature are enabled in the image by _DISM.exe_, for a full list of features, please review [this webpage](http:// | * the feature are enabled in the image by _DISM.exe_, for a full list of features, please review [this webpage](http:// | ||
| - | * -DiskLayout UEFI | + | * **-DiskLayout** UEFI |
| * the layout of the resulting disk, used if booting the disk in UEFI mode is desired. | * the layout of the resulting disk, used if booting the disk in UEFI mode is desired. | ||
| * default value is BIOS. | * default value is BIOS. | ||
| - | * -Index 3 | + | * **-Index** 3 |
| * index of the _.wim_ supplied as input, if applicable. | * index of the _.wim_ supplied as input, if applicable. | ||
| * default value is 1 and it will work in the vast majority of cases. | * default value is 1 and it will work in the vast majority of cases. | ||
| - | * -SerialBaudRate 8400 | + | * **-SerialBaudRate** 8400 |
| * baudrate of the serial port that is to be added to the disk. | * baudrate of the serial port that is to be added to the disk. | ||
| * default is 9600 and will work fine in the vast majority of cases. | * default is 9600 and will work fine in the vast majority of cases. | ||
| </ | </ | ||