Param(

    [string]$VolumeName = 'Backup',

    [string]$LetterVol  = 'X'
)

$query = "select * from win32_volume where Label='$VolumeName'"
$Vol = Get-CimInstance -Query $query

if($null -ne $vol)
{
    Write-Host "Disk $VolumeName found"
    Switch ($Vol.DriveLetter){
        $null {
            Write-Host "The disk $VolumeName hasn't a letter."
            Write-Host "Assigning letter : $_."
            Set-WmiInstance -InputObject $Vol `
                -Arguments @{DriveLetter=$LetterVol + ":"}
            break
        }
        $($LetterVol + ':'){
            Write-Host "Disk letter OK"
            break
        }
        default{
            Write-Host "The $VolumeName disk hasn't the good letter ($_). Changing is letter to $_."
            Set-WmiInstance -InputObject $Vol `
                -Arguments @{DriveLetter=$LetterVol + ":"}
        }
    }# End Switch
}
else
{
    Write-Host "No disk $VolumeName found"
}
