How to change the local disk name using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To change the local disk name using PowerShell, we can use the Set−Volume command. For example, we have Drive name F and its volume label is “New Volume” and need to change it to the “Temporary Storage” then we can change the label using its existing volume name or with the Drive letter.

To change the volume name with the Drive letter,

Set−Volume −DriveLetter 'E' −NewFileSystemLabel 'Temporary Storage'

To change it with the existing label,

Set−Volume −FileSystemLabel 'New Volume' −NewFileSystemLabel 'Temporary Storage'

For the remote system, we can use either Invoke−Command or the CIMSession parameter.

For example,

$sess = New−CimSession −ComputerName Labmachine2k12 Set−Volume −CimSession $sess −DriveLetter 'E' −NewFileSystemLabel 'Temporary Storage'
Published on 25-Jan-2021 07:17:20