May 21st, 2014

PowerTip: Use PowerShell and WMI to Change Disk Label

Doctor Scripto
Scripter

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.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.