Thanks to James! I donβt know why I had so many problems with this, but you made me go the right way.
Here is the final code to set the drive label. For those who use this, it will change the name of ANY removable disk attached to the system. If you only need to change the names of specific drive models, you can use WMI Win32_DiskDrive to narrow it down.
public void SetVolumeLabel(string newLabel) { DriveInfo[] allDrives = DriveInfo.GetDrives(); foreach (DriveInfo d in allDrives) { if (d.IsReady && d.DriveType == DriveType.Removable) { d.VolumeLabel = newLabel; } } } public string VolumeLabel { get; set; }
source share