Easiest way to get to the drive letter, is to drill down to the "DriveLetter" property.
This is a [String] so you can use the Substring method to extract just the first character like this:
$USBDrive = (Get-WmiObject Win32_Volume -Filter "DriveType='2'").DriveLetter.Substring(0,1)
Note: This will only work if you have exactly one USB drive. In real life you should always check:
$USBDrives = Get-WmiObject Win32_Volume -Filter "DriveType='2'"
if ($USBDrives -is [system.array]){
$USBDrive = $USBDrives[0].DriveLetter.Substring(0,1)
}else{
$USBDrive = $USBDrives.DriveLetter.Substring(0,1)
}
To answer the second part of your question, you can change the drive letter (and other properties) of your USB drive using Set-WmiInstance command.
$USBDrives = Get-WmiObject Win32_Volume -Filter "DriveType='2'"
if ($USBDrives -is [system.array]){
$USBDriveLetter = $USBDrives[0].DriveLetter
}else{
$USBDriveLetter = $USBDrives.DriveLetter
}
$USBDrive = Get-WmiObject win32_volume -Filter "DriveLetter = '$USBDriveLetter'"
Set-WmiInstance -InputObject $USBDrive -Arguments @{DriveLetter = "F:";Label = "Test"}