Tuesday, February 02, 2016

Make-USB-Bootable


# Before running the script check USB key disk number with get-disk command, run the script from
# elevated shell
# tested only on Powershell version 5.
# after you can use robocopy to copy whatever you want to boot, the command options will be:
# robocopy "source" "destination" /mir /xd "System Volume Information" "$Recycle.bin"
param($disk_number,$DriveLetter)
Clear-Disk -Number $disk_number -RemoveData
New-Partition -DiskNumber $disk_number -UseMaximumSize -IsActive -DriveLetter $DriveLetter
Format-Volume –FileSystem NTFS –DriveLetter $DriveLetter
set-location $env:windir\system32
.\bootsect.exe /NT60 ($DriveLetter+":")

No comments:

Post a Comment