I wanted to post some of the PowerShell scripts I've been creating recently for add-hock tasks.
If you've used Windows 2008 Clusters then you'll know how handy it is to use the Volume GUID rather than a drive letter. This very simple script shows you the volumes on a machine and the path you should use.
[Updated 21/7/2008]
Ok, there was some pretty big problems with the previous script I put here, the main one being, it wasn’t pulling back volumes from the cluster, but the windows volumes instead. As it happens, these can change depending on the machine your VM is running on (i.e. in a 2 node cluster, on A the Guid could be different to B).
Here is an updated version, which pulls back the GUID path, along with the Volume Label (it’s very handy to give Volumes distinct, understandable volume names). I use the same Volume name as LUN name (in Starwind).
1: Get-WmiObject -namespace root\MSCluster -class MSCluster_DiskPartition -computerName bbcluster1 | Select-Object VolumeLabel, Path
This will give you an output, something like this:
VolumeLabel Path
----------- ----
LUNa1 \\?\Volume{82be705f-4d94-11dd-8cb6-001e0b5a24a9}
1: Get-WmiObject -namespace root\cimv2 -computername machinename -class Win32_Volume | Select-Object Name, DeviceID
This will give an output something like this:
Name DeviceID
---- --------
C:\ \\?\Volume{08868f71-2bee-11dd-b880-806e6f6e6963}