[ad_1]
New to powershell and trying to figure out how to format all attached usb drives. The following code prompts for a drive letter during format, keeps iterating by one and won’t escape that assign drive letter prompt.
foreach ($usbDrive in get-disk)
{
if ($usbDrive.bustype -eq 'usb')
{
Format-Volume -FileSystem FAT32
}
}
This code seems to work but it prompts for more usb drives than are plugged in. If it’s possible, I’d like to have the drive keep the same letter and skip the prompt.
foreach ($usbDrive in get-disk | where bustype -eq 'usb'){Format-Volume -FileSystem FAT32}
[ad_2]