PowerShell Change Usb External Drive Letter using Usb Label like filter

Make an batch.cmd 

%Windir%\System32\WindowsPowerShell\v1.0\PowerShell.exe -exec bypass -noprofile -ExecutionPolicy Unrestricted -file c:\Set-VolumeDriveLetter.ps1

then

PowerShell Script and you need the last PowerShell version 4.0 .. link for installer

 

$drive = gwmi win32_volume -Filter "Label = 'extbackup'"

Function Set-VolumeDriveLetter ($oldvolume, $newvolume) {
if (!$oldvolume) {
Write-Host 'ERROR: You must enter a value for the current volume!' -BackgroundColor Red -ForegroundColor White
Break
}
elseif (!$newvolume) {
Write-Host 'ERROR: You must enter a value for the new volume!' -BackgroundColor Red -ForegroundColor White
Break
}
$driveavailable = (New-Object System.IO.DriveInfo($newvolume)).DriveType -ne 'NoRootDirectory'
If ($driveavailable) {
Write-Host "ERROR: Looks like your new volume $newvolume is already in use!" -BackgroundColor Red -ForegroundColor White
Break
}
$driveletter = Get-WmiObject win32_volume -filter "DriveLetter = '$oldvolume'"
If (!$driveletter) {
Write-Host "ERROR: Looks like your old volume $oldvolume does not exist!" -BackgroundColor Red -ForegroundColor White
Break
}
$driveletter.DriveLetter = $newvolume
$driveletter.Put() | Out-Null
If (!$Error) {
Write-Host "INFO: Drive letter $oldvolume changed to $newvolume!" -BackgroundColor DarkGreen -ForegroundColor White
}
}

Clear-Host
$Error.Clear()

Set-VolumeDriveLetter -oldvolume $drive.DriveLetter -newvolume "O:"