User Tools

Site Tools


diskimagescript-usage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revision Both sides next revision
diskimagescript-usage [2014/08/21 18:39]
anashwan Created wiki page for the Windows diskimage creation PowerShell script.
diskimagescript-usage [2014/08/22 18:23]
gsamfira
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_:
 ``` ```
-PS> (New-Object System.Net.WebClient).DownloadFile("https://msysgit.googlecode.com/files/Git-1.9.0-preview20140217.exe", "$HOME\Git-1.9.0-preview20140217.exe"+(New-Object System.Net.WebClient).DownloadFile("https://msysgit.googlecode.com/files/Git-1.9.0-preview20140217.exe", "$HOME\Git-1.9.0-preview20140217.exe"
-PS> cmd.exe /C call $HOME\Git-1.9.0-preview20140217.exe /SILENT+cmd.exe /C call $HOME\Git-1.9.0-preview20140217.exe /SILENT
 ``` ```
  
 #### 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):
 ``` ```
-PS> (New-Object System.Net.WebClient).DownloadFile("http://qemu.weilnetz.de/w64/qemu-w64-setup-20140801.exe", "$HOME\qemu-w64-setup-20140801.exe"+(New-Object System.Net.WebClient).DownloadFile("http://qemu.weilnetz.de/w64/qemu-w64-setup-20140801.exe", "$HOME\qemu-w64-setup-20140801.exe"
-PS> cmd.exe /C call $HOME\qemu-w64-setup-20140801.exe /SILENT+cmd.exe /C call $HOME\qemu-w64-setup-20140801.exe /SILENT
 ``` ```
  
 #### 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:
 ``` ```
-PS> $newPath = "$env:Path;${env:ProgramFiles(x86)}\Git\cmd;${env:ProgramFiles}\qemu" +$newPath = "$env:Path;${env:ProgramFiles(x86)}\Git\cmd;${env:ProgramFiles}\qemu" 
-PS> $env:Path = $newPath +$env:Path = $newPath 
-PS> setx PATH $newPath+setx PATH $newPath
 ``` ```
  
Line 34: Line 34:
 ## Getting the script: ## Getting the script:
 ``` ```
-PS> cd $HOME +cd $HOME 
-PS> git clone https://github.com/slokesh184/windows-diskimage-builder+git clone https://github.com/slokesh184/windows-diskimage-builder
 ``` ```
  
Line 43: Line 43:
 #### Start a new PowerShell session as administrator: #### Start a new PowerShell session as administrator:
 ``` ```
-PS> Start-Process PowerShell -Verb RunAs+Start-Process PowerShell -Verb RunAs
 ``` ```
  
Line 49: Line 49:
 ### Getting at the _.wim_ file of an _.iso_:   ### Getting at the _.wim_ file of an _.iso_:  
 ``` ```
-PS> $mountpoint = Mount-DiskImage -ImagePath C:\Absolute\Path\To\Your\Iso\Image.iso -PassThru +$mountpoint = Mount-DiskImage -ImagePath C:\Absolute\Path\To\Your\Iso\Image.iso -PassThru 
-PS> $wimfilePath = ($mountpoint | Get-Volume).DriveLetter + ":\sources\install.wim"+$wimfilePath = ($mountpoint | Get-Volume).DriveLetter + ":\sources\install.wim"
  
 # 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:
-PS> Dismount-DiskImage -ImagePath C:\Absolute\Path\To\Your\Iso\Image.iso+Dismount-DiskImage -ImagePath C:\Absolute\Path\To\Your\Iso\Image.iso
 ``` ```
  
 ### Creating a _.vhd_: ### Creating a _.vhd_:
 ``` ```
-PS> cd $HOME\windows-diskimage-builder\windows-diskimage-builder+cd $HOME\windows-diskimage-builder\windows-diskimage-builder
 # previous steps for obtaining the $wimfilePath are assumed to have been done # previous steps for obtaining the $wimfilePath are assumed to have been done
-PS> .\diskimagebuilder.ps1 -SourceFile $wimfilePath -VHDFile $HOME\resultingDiskImage.vhd -VHDSize 16+.\diskimagebuilder.ps1 -SourceFile $wimfilePath -VHDFile $HOME\resultingDiskImage.vhd -VHDSize 16
 ``` ```
 * *Notes:* * *Notes:*
Line 69: Line 69:
 ### Creating a _.qcow2_: ### Creating a _.qcow2_:
 ``` ```
-PS> .\diskimagebuilder.ps1 -SourceFile $wimfilePath -VHDFile $HOME\resultingDiskImage.vhd -VHDSize 16 -OutputFormat qcow2+.\diskimagebuilder.ps1 -SourceFile $wimfilePath -VHDFile $HOME\resultingDiskImage.vhd -VHDSize 16 -OutputFormat qcow2
 ``` ```
 * **Notes:** * **Notes:**
diskimagescript-usage.txt · Last modified: 2014/08/26 19:14 by anashwan