PSCX: Set-VolumeLabel
Need to change a volume label. It couldn’t be easier.
Set-VolumeLabel -Path g:\ -Label "Heroes"
Will change the label of the g: drive.
PSCX doesn’t supply a cmdlet to read volume labels. But we can get round that with a bit of WMI
| 001 002 003 004 005 006 007 008 009 010 011 012
| function Get-VolumeLabel { param ([string]$computer=".", [string]$drive = $null ) if ($drive){ if ($drive -notlike "?:"){ Throw "Drive should be submitted as letter and colon e.g. C:"} $wmiq = Get-WmiObject -Class Win32_LogicalDisk -Filter "DeviceId='$($drive)'" -Computer $computer } else {$wmiq = Get-WmiObject -Class Win32_LogicalDisk -Computer $computer} $wmiq | select DeviceId, VolumeName } |