Wednesday, October 10, 2007

ClusterSize

I recently had to complete a survey of the actual clustersizes used on a bunch of SQL Servers. In order to obtain this information, I came up with the small script below.
The script will list all drives (including drives without driveletters assigned, only mountpoints):

As noted by a reader the WMI class "Win32_Volume", is only available on Windows 2003 Server & Windows 2008 Server.

$servers = "myServer1.domain.x", "myServer2.domain.y"
$accData = $null
foreach ($server in $servers) {
    $dataFromServer = Get-WmiObject Win32_Volume -ComputerName $server | Select-Object SystemName,Name,DriveLetter,DriveType,Blocksize,Filesystem
    $accData = $accData + $dataFromServer
}

$accData | ConvertTo-Html | Set-Content "VolumeList.html"

3 comments:

PReetamZ said...

Alas this was available on my Favorite OS, which is still Windows XP, SP2. WIn32_volume is not available for everyone :(

Whatever your blog is very impressive and it is always.

techstarts.wordpress.com

E said...

This appears to be reporting the block size, not the cluster size. Neat script in any case

E said...

My mistake - it appears Win32.blocksize = cluster size = allocation unit.