I have a Powershell script on my windows machine that needs to access data from a USB drive. It reads a file from the USB stick and does its thing. I need to do this over many machines. The problem is that the USB drive can appear under different drive letters, depending on the machine I insert the stick into. My USB drive is called "USBData". Is there a way to reliably access the USB drive using its name rather than its drive letter?
$driveletter = (Get-Volume -FileSystemLabel "USBData").DriveLetter
echo "${driveletter}:\"