Search Wiki:

Introduction


The Install-WindowsImage PowerShell script uses the wimgapi.dll in Windows 7 or Windows Server 2008 R2 to apply a Windows image in a .wim file to a specified location. The script can be used to apply a Windows 7 or Windows Server 2008 R2 .wim image to a Virtual Hard Disk (VHD) used for native VHD boot or to boot in a Hyper-V virtual machine.

The Using Install-WindowsImage document provides a step-by-step walkthrough of how to create a VHD in Windows 7 and use Install-WindowsImage to apply an image for native boot. The document is available on the Downloads tab in Microsoft Office Word 2007 (.docx) or Protable Documentation Format (.pdf).

A related tool, WIM2VHD, is available from the MSDN Code Gallery that automates the steps of VHD creation and applying a .wim image using the Imagex deployment tool from the Windows Automated Installation Kit (AIK).

Requirements


• A machine running Windows 7 or Windows Server 2008 R2.
• Windows 7 or Windows Server 2008 R2 installation media.
or
• A Windows 7 or Windows Server 2008 R2 .wim image captured from a reference machine.

Additional Resources

What's New in Windows 7 Virtual Hard Disks available at http://technet.microsoft.com/en-us/library/dd440864.aspx

Windows Automated Installation Kit (AIK) for Windows 7 for tools and documentation designed for IT Professionals to deploy Windows at http://technet.microsoft.com/en-us/library/dd349343(WS.10).aspx

WIM2VHD on MSDN Code Gallery at http://archive.msdn.microsoft.com/wim2vhd

Usage

The usage help text for Install-WindowsImage.ps1 is the following:

//
PS > help .\Install-WindowsImage.ps1 –detailed
 
NAME
    Install-WindowsImage.ps1
    
SYNOPSIS
    Lists or applies Windows Images in .WIM containers.
    
    
SYNTAX
    C:\Vhd\Install-WindowsImage.ps1 -WIM <String> [<CommonParameters>]
    
    C:\Vhd\Install-WindowsImage.ps1 -WIM <String> -Apply -Index <Int32> -Destination <String> [<CommonParameters>]
    
    
DESCRIPTION
    
 
PARAMETERS
    -WIM <String>
        Specifies the .WIM file to examine and/or apply images from.
        
    -Apply [<SwitchParameter>]
        Specifies that the specified image index should be applied to the specified Destination.
        
    -Index <Int32>
        Specifies the image index of the Windows Image to apply to the specified Destination.
        
    -Destination <String>
        The drive or folder to apply the specified Windows Image to.
        
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        "get-help about_commonparameters".
    
    -------------------------- EXAMPLE 1 --------------------------
    
    C:\PS>This example will list the available images in the D:\Sources\Install.wim container.
    
    .\Install-WindowsImage.ps1 -WIM D:\Sources\Install.wim
   
    -------------------------- EXAMPLE 2 --------------------------
    
    C:\PS>This example will apply image number 8 from D:\Sources\Install.wim to X:\.
    
    .\Install-WindowsImage.ps1 -WIM D:\Sources\Install.wim -Apply -Index 8 -Destination
 
Last edited May 12 2009 at 2:43 AM  by Petebr, version 3
Comments
Chas2003 wrote  Jul 23 2012 at 5:28 PM  
Scary when I go to download at the link I get a message "Publisher of software can not be verified'. Too scary for me.

Chas2003 wrote  Jul 23 2012 at 7:50 PM  
Ok I got desperate and gave it at try. But I want to create a VHD on Win 7 that will boot Win 8. The comments look like it only runs on Win 8 and I can't get the one here that is obsolete. Can I get anything that will run on Win 7 and create a VHD for win 8?

Fasin wrote  Jul 5 2013 at 11:49 PM  
Google is your Friend ;)

http://archive.msdn.microsoft.com/InstallWindowsImage/Release/ProjectReleases.aspx?ReleaseId=2662

Fasin wrote  Jul 5 2013 at 11:56 PM  
lol, its even here in the downloads-section, one tab to the right ;)

Updating...
Page view tracker