PowerShell Scripting - Create USB Install Media for Windows 10  

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #10

    HippsieGypsie said:
    Made my install thumb with your script provided in step 1 and followed the tutorial section to the tee. Before starting I quick formatted it with default settings. Ran the script and all went well, but it doesn't show up in FE and when I open Disk Management it asked to initialize it as seen below. Is that normal? If so, initialize it as GPT, yes?
    No, that is not correct. The USB flash drive should be partitioned, and all well and shown in Explorer and Disk Management with a drive ID letter. MBR or GPT is irrelevant but it should have been partitioned.

    Initialize it, GPT is OK and run the script again to test.

    I have to go out now, have a doc appointment. I'll check what's going on when back home.
    Last edited by Kari; 25 Oct 2017 at 02:56.
      My Computer


  2. Posts : 5,833
    Dual boot Windows 10 FCU Pro x 64 & current Insider 10 Pro
       #11

    @Kari

    Been attempting to get this to work without success for too long. Time to ask for help.

    Info: Performing this on my Asus tower in FCU with a SanDisk 8GB thumb using PS ISE Admin opening a saved script titled “Create Bootable ISO Thumb(.ps1)” which is stored on my secondary D: drive. Mounting ISOs made from WTC and UUPtoISO that are also stored on my D: drive mounting on virtual drive. Directing script to the correct virtual drive.

    Each time the script runs for less than a minute, hence my previous joke about java and shot. I’ll assume that’s not normal, for I’ve created ISO thumbs before using Rufus, which takes much longer.

    I actually ran the script more times using different scenarios, but here are the highlights.

    Run 1: I initialized the disk GPT as instructed above and ran the script > No go. The disk is then not seen in FE and not initialized upon opening Disk Management (DM) again.

    Run 2: I initialized as GPT and formatted this time. After running it did not de-initialized the disk, but still empty. I took shots of PS script running. Here are a few. one from early on and one from the end. Something is not correct there > Network path not found.

    Attachment 160188

    Attachment 160189

    Run 3: Reformatted as MBR and ran script. No go.

    Closed everything out and rebooted.

    Run 4: I’ve run some of your prior saved scripts from D: with success, so I don’t think it’s that, but instead of using my stored “Create Bootable ISO Thumb”, this time I copied and pasted the script directly into PS ISE. Didn’t catch the first part, but this is seen throughout the latter part of the run. It has a little different results, but same error.

    Attachment 160190

    The thumb drive remains empty. Any clue as to why?
      My Computers


  3. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #12

    HippsieGypsie said:
    The thumb drive remains empty. Any clue as to why?
    Logically thinking it can only be a defect USB drive, missing code caused by an error in Copy & Paste or permissions issue. The error messages in your first screenshot are all about path / file not found or existing when saving to USB.

    Do you have another USB drive to test?
      My Computer


  4. Posts : 5,833
    Dual boot Windows 10 FCU Pro x 64 & current Insider 10 Pro
       #13

    Kari said:
    Logically thinking it can only be a defect USB drive, missing code caused by an error in Copy & Paste or permissions issue. The error messages in your first screenshot are all about path / file not found or existing when saving to USB.

    Do you have another USB drive to test?
    Ok. I see. Yes, I have another. Thanks, Kari.
      My Computers


  5. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #14

    HippsieGypsie said:
    Ok. I see. Yes, I have another. Thanks, Kari.
    Copy & paste mistakes can be excluded, I think, because according to your error messages the errors occur in cmdlet Copy-Item $File.fullname ($USBDrive + $RelativePath) in line 184; I just checked and that cmdlet is line 184 in original code
      My Computer


  6. Posts : 5,833
    Dual boot Windows 10 FCU Pro x 64 & current Insider 10 Pro
       #15

    Yes, odds are that I could not error in that twice, for I C&Ped it once to save as ps1 file and then C&Ped again right into PS. It isn't the script. It's got to be the drive as you say.

    17025 has been released. My Asus Insider is almost finished updating and I'll get back to this. It's going quite fast. :)
      My Computers


  7. Posts : 5,833
    Dual boot Windows 10 FCU Pro x 64 & current Insider 10 Pro
       #16

    Finally got to this. Used another thumb and did indeed work with time for java and shot.

    Thing is, this is an older PNY 8GB thumb. I burn ISOs on the SanDisk thumb with Rufus all the time. Don't understand why SanDisk didn't work.

    Edit:

    Just burned my UUPtoISO 17025.1000 to the SanDisk to make sure the thumb is ok and to have it.

    Used PS with same 17025 to make another PNY thumb for my 2nd partition install. All went well.
    Last edited by Tony K; 26 Oct 2017 at 02:50.
      My Computers


  8. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #17

    HippsieGypsie said:
    Finally got to this. Used another thumb and did indeed work with time for java and shot.

    Thing is, this is an older PNY 8GB thumb. I burn ISOs on the SanDisk thumb with Rufus all the time. Don't understand why SanDisk didn't work.
    Can't explain why that SanDisk drive works with Rufus but not from PowerShell script. Anyway, good to know you got it working.
      My Computer


  9. Posts : 5,833
    Dual boot Windows 10 FCU Pro x 64 & current Insider 10 Pro
       #18

    Kari said:
    Can't explain why that SanDisk drive works with Rufus but not from PowerShell script.
    I swear there's a wormhole somewhere in computer tech that we just can't see. Like quantum physics, the most brilliant in the field don't fully understands it.

    Anyway, good to know you got it working.
    No, my friend. Good to know you got it working with your direction. Thanks. One thing I know is that doing something over and over again getting the same ill results is true insanity.
      My Computers


  10. Posts : 33
    Windows 10 Pro for Workstations
       #19

    You spent way too much time trying to make every safety-net as possible (will get back to this), and instead are offering a "tutorial" of some fairly dreadful code.

    You should be working with mostly objects for disk structuring and not user input and using the same cmdlet class throughout the processes.

    You have none of this "error-handling" you went on about in case the WIM file was too big for the FAT32 filesystem (4GB), where you could easily add a process to split the WIM to SWM before creating the directory tree on the USB and copying over the ISO content.

    Why do you have 6 lines of "-or" code of this script testing the path for install images when there's the -Include parameter available on the Get-ChildItems cmdlet that is designed specifically for this?

    You have a picture telling people to not click the format button when the GUI screen pops up. Well, that's why you do not let that screen pop up, and you do that by writing proper code. You should not be assigning a drive letter using the New-Partition cmdlet for scripts like this, anyways. Instead you pipe the partition object to the Add-PartitionAccessPath cmdlet with the -AssignDriveLetter, wherein no GUI output is displayed and the access paths become objects themselves. This is the only way to do any sort of disk imaging in a reliable way:

    $Partition = New-Partition -DiskNumber $Disk.Number -Size 32GB
    $Format = Format-Volume -Partition $Partition -FileSystem FAT32 -Force -Confirm:$false
    $Partition | Add-PartitionAccessPath -AssignDriveLetter
    $Drive = ($Disk | Get-Partition).AccessPath[0]

    Instead you have this, which is completely unnecessary.

    $USBDrive = Get-WmiObject Win32_Volume -Filter "DriveType='2'"
    $USBDrive = $USBDrive.DriveLetter
    Format-Volume -NewFileSystemLabel "W10 USB" -FileSystem FAT32 -DriveLetter $USBDrive.Trim(":", " ")

    Again with all this coloring and questions...why not utilize the actual features PowerShell has like ConfirmImpact and SupportsShouldProcess, thus requiring input based on how high the impact of the command may make on a device?

    This script has zero error-handling other than total reliance of the end-user, which PowerShell scripts (and C#, Java, etc.) are not designed for. That's because these wonderful languages have a plethora of ways to do proper error-handling using only the objects that are created and utilized within the script itself.

    I've looked at some of your other scripts a few minutes ago and they're all the same, too. If I uploaded a script like this to any of the coding repositories I put some of my actual projects on, they'd be removed the same hour I uploaded them.
      My Computers


 

Tutorial Categories

PowerShell Scripting - Create USB Install Media for Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:48.
Find Us




Windows 10 Forums