Script to format USB drives temporarily killing USB ports RRS feed

  • Question

  • Hi,

    I've written the script below to format any USB drives attached to a system.

    Get-Disk |
    Where bustype -eq 'usb' |
    Clear-Disk -RemoveData -PassThru -Confirm:$false |
    New-Partition -AssignDriveLetter -Alignment 4194304 -UseMaximumSize |
    Format-Volume -FileSystem exFAT -NewFileSystemLabel myUSB

    When I ran this on a Windows 10 Pro system, it caused the USB port that the drive was connected to to become unresponsive to any device. The drive was also not formatted.

    The port became operational again after a reboot.

    I then ran the script with the same drive in the same port successfully.

    Any ideas what might be happening?

    Wednesday, January 29, 2020 2:57 PM

All replies

  • It sounds as though it only happened once overall. Did it happen a second or third time? If not, then it's difficult to know/troubleshoot. My assumption is that it likely has nothing to do with PowerShell, but instead the drive and/or system (prior to that reboot). I could be wrong, so test with other drives and monitor whether it happens again with the initial drive or not.
    Thursday, January 30, 2020 9:22 PM