There are lot of ways to create a bootable USB disk, like using command prompt, windows tools and many 3rd party software. In oldern days we used to install operating system using CD/DVD, Those days were are gone now in modern days flash drive are become popular Today in this post we are going to create a bootable USB disk using PowerShell. PowerShell is an advanced form of command prompt. It is extended with a huge set of ready-to-use cmdlets and comes with the ability to use .NET framework/C#. Which can be embedded within other applications. It automates batch processing and creates system management tools. It includes more than 130 standard command line tools for functions and enables administrators to perform tasks on local and remote Windows systems through access to Component Object Model (COM) and Windows Management Instrumentation (WMI). So without wasting any time will jump into the topic.

In this post I include two methods, will see detail about it.

Method 1:

  • Open Power shell in admin mode, copy and paste the below mentioned command.
Copy to Clipboard

Let’s see in details about these command.

$Results= Get-Disk : First this command will list out all the attached drives, its like diskpart command, In diskpart we use list disk to know the drive letters and attached usb drives.

Where-Object BusType -eq USB : After listing all connected drives this command will filter out the USB drive.

Out-GridView -Title ‘Select USB Drive to Format’ -OutputMode Single:  This command will give you the list of USB Drive in a grid view. Now you can choose the correct disk and click ok.

Clear-Disk -RemoveData -RemoveOEM -Confirm:$false –PassThru: This command clear all the data in the partition off the disk.

New-Partition -UseMaximumSize -IsActive –AssignDriveLetter: This command creates a new partition using all of the available space on the USB drive and assigns a drive letter to it.

Format-Volume -FileSystem FAT32: This command Format the USB drive in FAT 32 format. You can choose different format also, instead of FAT32 you can type NTFS or some other format. Here we use FAT32 because most of the laptop and server won’t boot the USB Drive in NTFS format.

So as for now the USB Drive has been successfully formatted in FAT32 format and ready to copy to the OS files. Now will Jump to the next session.

Copy to Clipboard

This command get the ISO file path and copy the files to already mounted USB drive. Choose the ISO file path correctly.

Copy to Clipboard

This command will make the USB Drive bootable.

Method 2:

I think compare to the first method the second one is the best, in this method we are going to use script which is very handy to use it more, and also there is no need to memorise bunch of command line, you can achive making bootable USB in single line of code.

In my case the USB stick is associated with E: and the ISO is mounted on F:. The following command sets up an bootable Windows USB stick:

Open Power shell ISE in admin mode, copy and paste the below mention command.

Create-BootableUSBStick -USBDriveLetter D: -ImageFiles H:

Copy to Clipboard

you have to create a folder in C:\Program Files\WindowsPowerShell\Modules. Name it Create-BootableUSBStick. Then Save this code whatever the name you want

Example : BootableUSBStick.psm1

Then open the power shell in the admin mode and type the below mention command.

Create-BootableUSBStick -USBDriveLetter D: -ImageFiles H:

Here you have to mention the USB drive Letter at the first and the image file path. Suppose if you mounter the iso in the separate drive you can mention the same path here.

Try this method if you have any doubt or difficulties kindly ping me in the comments.