diff --git a/functions/microwin/Invoke-Microwin.ps1 b/functions/microwin/Invoke-Microwin.ps1
index a854b939..4b2509dc 100644
--- a/functions/microwin/Invoke-Microwin.ps1
+++ b/functions/microwin/Invoke-Microwin.ps1
@@ -55,6 +55,7 @@ public class PowerManagement {
Write-Host "Index chosen: '$index' from $($sync.MicrowinWindowsFlavors.SelectedValue)"
$copyToUSB = $sync.WPFMicrowinCopyToUsb.IsChecked
+ $bootable = $sync.WPFMicrowinBootable.IsChecked
$injectDrivers = $sync.MicrowinInjectDrivers.IsChecked
$importDrivers = $sync.MicrowinImportDrivers.IsChecked
@@ -628,6 +629,12 @@ public class PowerManagement {
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
}
+ if ($bootable) {
+ Write-Host "Making Bootable USB drive"
+ Microwin-BootableUSB("$($SaveDialog.FileName)")
+ if ($?) { Write-Host "Done making bootable USB drive!" } else { Write-Host "Bootable USB creation failed." }
+ }
+
Write-Host " _____ "
Write-Host "(____ \ "
Write-Host " _ \ \ ___ ____ ____ "
diff --git a/functions/microwin/Microwin-BootableUSB.ps1 b/functions/microwin/Microwin-BootableUSB.ps1
new file mode 100644
index 00000000..9d06b15f
--- /dev/null
+++ b/functions/microwin/Microwin-BootableUSB.ps1
@@ -0,0 +1,58 @@
+function MicroWin-BootableUSB {
+ [CmdletBinding()]
+ param (
+ [Parameter(Mandatory=$true)]
+ [string]$IsoPath
+ )
+
+ $TargetDisk = Get-Disk | Where-Object { $_.BusType -eq 'USB' -and $_.OperationalStatus -eq 'Online' } |
+ Sort-Object Number |
+ Out-GridView -Title "MicroWin: Select Target USB Drive" -OutputMode Single
+
+ if (-not $TargetDisk) {
+ Write-Warning "No USB drive selected. Operation cancelled."
+ return
+ }
+
+ $msgTitle = "MicroWin USB Warning"
+ $msgText = "WARNING: ALL DATA ON DISK $($TargetDisk.Number) WILL BE DELETED!`n`nAre you sure you want to proceed?"
+ $msgIcon = [System.Windows.MessageBoxImage]::Warning
+ $msgButton = [System.Windows.MessageBoxButton]::YesNo
+
+ $Response = [System.Windows.MessageBox]::Show($msgText, $msgTitle, $msgButton, $msgIcon)
+ if ($Response -ne "Yes") {
+ Write-Warning "Operation cancelled by user."
+ return
+ }
+
+ try {
+ Write-Host "Cleaning Disk $($TargetDisk.Number)..." -ForegroundColor Yellow
+ $TargetDisk | Clear-Disk -RemoveData -Confirm:$false
+ $TargetDisk | Initialize-Disk -PartitionStyle GPT -PassThru -ErrorAction SilentlyContinue | Out-Null
+
+ Write-Host "Creating NTFS Partition..." -ForegroundColor Yellow
+ $Partition = New-Partition -DiskNumber $TargetDisk.Number -UseMaximumSize -AssignDriveLetter
+ $USBLetter = "$($Partition.DriveLetter):"
+
+ Format-Volume -DriveLetter $Partition.DriveLetter -FileSystem NTFS -NewFileSystemLabel "MicroWin" -Confirm:$false
+
+ Write-Host "Mounting ISO: $IsoPath" -ForegroundColor Cyan
+ $Mount = Mount-DiskImage -ImagePath $IsoPath -PassThru
+ $IsoLetter = ($Mount | Get-Volume).DriveLetter + ":"
+
+ Write-Host "Copying files to $USBLetter (this may take a few minutes)..." -ForegroundColor Cyan
+ Copy-Files "$($IsoLetter)" "$($USBLetter)" -Recurse -Force
+
+ if (Test-Path "$IsoLetter\boot\bootsect.exe") {
+ Write-Host "Applying Boot Code..." -ForegroundColor Green
+ Set-Location "$IsoLetter\boot"
+ ./bootsect.exe /nt60 "$USBLetter" /force /mbr
+ }
+
+ Dismount-DiskImage -ImagePath $IsoPath
+ Write-Host "SUCCESS: MicroWin USB created on $USBLetter" -ForegroundColor Green
+ }
+ catch {
+ Write-Error "Failed to create USB: $($_.Exception.Message)"
+ }
+}
\ No newline at end of file
diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml
index 295df951..a5266bcf 100644
--- a/xaml/inputXML.xaml
+++ b/xaml/inputXML.xaml
@@ -1459,6 +1459,7 @@
+
Custom user settings (leave empty for default user)
User name (20 characters max.):