I have an external USB drive that I use for backups. The backups are performed by a PowerShell script. My problem is that the drive letters change frequently, as other USB drives are plugged in and unplugged.
I updated the PowerShell script to determine the drive letter based on the volume name, which does not change. Here is the code that does this:
function GetDriveLetter($volume_name)
{
$drive = Get-WmiObject win32_logicaldisk | Where-Object {$_.VolumeName-eq $volume_name } | select -ExpandProperty DeviceID
if ($drive -eq $null)
{
Throw "Cannot find drive with volume name of " + $volume_name
}
return $drive
}
| Title | Date |
| Node.js + Express: How to Block Requests by User-Agent Headers | January 7, 2026 |
| Vault 3 is Now Available for Windows on ARM Machines! | December 13, 2025 |
| Vault 3: How to Include Outline Text in Exported Photos | October 26, 2025 |
| .NET Public-Key (Asymmetric) Cryptography Demo | July 20, 2025 |
| Raspberry Pi 3B+ Photo Frame | June 17, 2025 |
| EBTCalc (Android) Version 1.53 is now available | May 19, 2024 |
| Vault 3 Security Enhancements | October 24, 2023 |