Rename Drive Label

by Jul 23, 2010

WMI can also read any drive label (the name that appears next to a drive inside Explorer), and you can change the drive label, too—provided you have administrator privileges. This code renames drive c:\ to "My Harddrive":

$drive = [wmi]"Win32_logicaldisk='C:'"
$drive.VolumeName = "My Harddrive"
$drive.Put()

Just make sure to call Put() so your changes will get written back to the original object.

Twitter This Tip! ReTweet this Tip!