Thursday, March 25, 2010

How to get logical drive information

As a DBA you might want to get storage information of a server. It may be a local server, remote server or multiple servers. 


Lets assume you want to create a report with the format given below;


[DeviceID, VolumeName, Size, FreeSpace]


If it is single server you may be able to prepare the report easily by going though the "My Computer". What if the report needs to prepared for 20 servers. 


You can create a powershell script for this task. I've created the below script to extract logical drive information for a given server and put the output in an Excel file.