PowerTip: Use PowerShell and WMI to Change Disk Label

Doctor Scripto

Summary: Learn how to use Windows PowerShell and WMI to change a disk label.

Hey, Scripting Guy! Question How can I use Windows PowerShell with WMI to change the disk label on a logical disk?

Hey, Scripting Guy! Answer Beginning with Windows PowerShell 3.0, use the Get-CimInstance cmdlet to retrieve
          the logical disk, and then use the Set-CimInstance cmdlet to set the VolumeName:

Get-CimInstance win32_logicaldisk -Filter "deviceID = 'c:'" |

Set-CimInstance -Property @{volumename = 'SSD'}

Note  This technique requires you to start the Windows PowerShell console with elevated rights.


Discussion is closed.

Feedback usabilla icon