Installing Windows to external drive from Windows


This has been tested to work with Windows 10.

Insert or mount Windows installation disc/iso. Note the drive letter. For the sake of this post, I’m using D: as the iso mount point, and E: as the usb drive letter.

From an administrator-level command prompt or powershell, use diskpart to prepare the external drive (replacing the drive letter with something appropriate for your circumstances):

C:> DISKPART

DISKPART> LIST DISK

  
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          298 GB      0 B
  Disk 1    Online           29 GB      0 B

DISKPART> SELECT DISK 1

Disk 1 is now the selected disk.

DISKPART> CLEAN

DiskPart succeeded in cleaning the disk.

DISKPART> CREATE PARTITION PRIMARY

DiskPart succeeded in creating the specified partition.

DISKPART> FORMAT FS=NTFS QUICK

  100 percent completed

DiskPart successfully formatted the volume.

DISKPART> ACTIVE

DiskPart marked the current partition as active.

DISKPART> ASSIGN LETTER=E

DiskPart successfully assigned the drive letter or mount point.

DISKPART> EXIT

Leaving DiskPart...

C:>

At this point, you may need to open Disk Management in order to assign a drive letter to your newly-formatted USB drive.

Use the DISM build-in command. Sometimes install.wim is named differently, like install.esd. It is usually, by far, the largest file in the iso, so it should be easy to find.

To determine which index you wish to use:

C:> dism /get-wiminfo /wimfile:D:\sources\install.wim

To apply an image, using Windows 10 (this part will likely take a while):

C:>dism /Apply-Image /imagefile:D:\sources\install.wim /index:1 /ApplyDir:E:\

If you’re using Windows 10, skip to the part about installing Windows boot files. If you’re using Windows 7, applying the image can get a bit more tedious, but it’s still possible. First, download imagex.exe as outlined in the article linked at the end of this post. Alternatively, those connected to my VPN can download it from here. Then, navigate to where you’ve placed the downloaded file (for me, it was C:\Users\Brandon\Downloads\):

C:\Users\Brandon\Downloads>.\imagex.exe /apply D:\sources\install.wim 1 E:\

By the way, the previous method also works in Windows 10, but it is unnecessary, as the built-in DISM tool can take care of it.

Then, copy all files from E:\mount\ to E:\.

Install Windows boot files:

bcdboot E:\WINDOWS /S E: /F ALL

In Windows 7, you may need to omit the /F ALL from the above command.

Done!

If you want to enable the Windows Store in this new installation, do this from inside your new installation:

C:> gpedit

Under Computer Configuration, open Administrative Templates | Windows Components | Store.

In the right pane, right-click the entry Allow Store to install apps on Windows To Go workspaces and click Edit to select the Enabled option and click OK.

Most credit goes to this article and its comments.


Leave a Reply