ISO to USB V2.1

There are a lot of ISO burning tools out there and some work but some have issues with specific ISO files so I decided to make my own using powershell. To use it you simply browse to your ISO file then type in the driver letter you want the ISO to be burnt to.

If you dint want to mess with the PwoerShell code you can get an exe version of the tool from HERE


Script to create a bootable flashdrive from a ISO

The script will launch a GUI. From the interafece you will be shown all of the drive on your computer
first you 

Created By: Kris Gross
Twitter: @kmgamd



#Gets the volume info
Function Get-Vol {
Get-Volume | Select-Object -Property DriveLetter, FileSystem, Drivetype |
Where-Object {$_.DriveLetter -ne $Null}

#Runs the Burn process
Function Run-BurnISO 

#Sets ISO file and disk letter
$iso = $textbox1.Text
$disk = $textBox3.Text
#Gets the disk number for diskpart
$DriveNumber = (Get-Partition -DriveLetter $disk).DiskNumber
#Mounts the ISO file
Mount-DiskImage -ImagePath "$iso"
# Get-Disk $DriveNumber | Clear-Disk -RemoveData
Format-Volume -DriveLetter $disk -FileSystem FAT32 -NewFileSystemLabel USB

#gets the drive letter of where the ISO gets mounted to
$MountLetter = (Get-DiskImage $iso | Get-Volume).DriveLetter

#Sets Variable for copy process
$Source = $MountLetter + ":\"
$Destination = $disk + ":\"
$bootdir = $disk + ":"

#Makes the drive bootbale
bootsect.exe /nt60 $bootdir

$Filelist = Get-Childitem $Source -Recurse
$Total = $Filelist.count
$Position = 0
foreach ($File in $Filelist)
    $Label4.text = "Copying $File"
 Copy-Item $File.FullName $DestinationFile -Force
    $Percentage = (($Position/$Total)*100)
    $PB.Value = $Percentage
    Start-Sleep -Milliseconds 150

#Dismounts the ISO file
Dismount-DiskImage -ImagePath "$iso"

[System.Windows.Forms.MessageBox]::Show("Your USB Drive is ready to use.")

#Opend the file broswser to select your ISO File
Function Get-FilePath{
    [String]$Filter = "|*.ISO",
    [String]$InitialDirectory = "C:\")

    $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
    $OpenFileDialog.initialDirectory = $InitialDirectory
    $OpenFileDialog.filter = $Filter
    #Runs the form function over so the results are added to the text box

#Generates the form
Function Generate-Form {

#Needed for the form to show
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

#Set the standrads of the form window
$form = New-Object System.Windows.Forms.Form 
$form.Text = "ISOtoUSB - V"
$form.Size = New-Object System.Drawing.Size(460,380) 
$form.StartPosition = "CenterScreen"

#sets the ok button
$BurnButton = New-Object System.Windows.Forms.Button
$BurnButton.Location = New-Object System.Drawing.Point(25,250)
$BurnButton.Size = New-Object System.Drawing.Size(75,23)
$BurnButton.Text = "Burn"
$BurnButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
$form.AcceptButton = $BurnButton

#sets the cancel Button
$CancelButton = New-Object System.Windows.Forms.Button
$CancelButton.Location = New-Object System.Drawing.Point(125,250)
$CancelButton.Size = New-Object System.Drawing.Size(75,23)
$CancelButton.Text = "Cancel"
$CancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
$form.CancelButton = $CancelButton

#sets the Browse Button
$BrowseButton = New-Object System.Windows.Forms.Button
$BrowseButton.Location = New-Object System.Drawing.Point(320,160)
$BrowseButton.Size = New-Object System.Drawing.Size(75,23)
$BrowseButton.Text = "Browse"
$BrowseButton.DialogResult = [System.Windows.Forms.DialogResult]::Yes
$form.AcceptButton = $BrowseButton
$BrowseButton.Add_Click({$textBox1.Text = Get-FilePath -InitialDirectory "$env:UserProfile\Desktop"})

#Text box for ISO file location
$textBox1 = New-Object System.Windows.Forms.TextBox 
$textBox1.Location = New-Object System.Drawing.Point(24,165)
$textBox1.Size = New-Object System.Drawing.Size(260,22)
$textBox1.Font = 'Lucida Console' 
$textBox1.Text = $OpenFileDialog.filename

#Sets the avalibale drives
$textBox2 = New-Object System.Windows.Forms.TextBox
$textBox2.Location = New-Object System.Drawing.Point(24,40) 
$textBox2.Size = New-Object System.Drawing.Size(400,100)
$textBox2.ReadOnly = $True
$textBox2.Multiline = $True
$textBox2.Font = 'Lucida Console'
$textBox2.Text = Get-Vol | Format-Table | Out-String

#Sets the entry box for Drive letter
$textBox3 = New-Object System.Windows.Forms.TextBox
$textBox3.Location = New-Object System.Drawing.Point(24,210)
$textBox3.Size = New-Object System.Drawing.Size(260,22)
$textBox3.Font = 'Lucida Console'
$textBox3.Text = "Type the drive letter only"

#Create a ProgressBar 
$PB = New-Object System.Windows.Forms.ProgressBar
$PB.Name = "PowerShellProgressBar"
$PB.Size = New-Object System.Drawing.Size(400,20)
$PB.Location = New-Object System.Drawing.Point(25,300)
$PB.Value = 0

#Label for Drive letter selcetion
$label1 = New-Object System.Windows.Forms.Label
$label1.Location = New-Object System.Drawing.Point(24,190)
$label1.Size = New-Object System.Drawing.Size(280,13) 
$label1.Text = "2. Drive:"

#label for ISO path text box
$label2 = New-Object System.Windows.Forms.Label
$label2.Location = New-Object System.Drawing.Point(24,145)
$label2.Size = New-Object System.Drawing.Size(280,13) 
$label2.Text = "1. ISO File:"

#lable for avaliable drives
$label3 = New-Object System.Windows.Forms.Label
$label3.Location = New-Object System.Drawing.Point(24,20) 
$label3.Size = New-Object System.Drawing.Size(280,13) 
$label3.Text = "Avaliable Drives:"

$Label4 = New-Object System.Windows.Forms.Label
$Label4.Location = New-Object System.Drawing.Point(25,280)
$Label4.Size = New-Object System.Drawing.Size(280,13)
$Label4.Text = ""

#add all resorces of the form 

#Show the Form 
 $form.Topmost = $True

#Call the Function 

Popular Posts

Office 365 Deployment - Office 365 Upgrade Task Sequence

SCCM Task Sequence with GUI - How to install more then one image with a single Task Sequence

Windows 10 Setup Script - V