SQL SERVER – Powershell – Get a List of Fixed Hard Drive and Free Space on Server

Earlier I have written this article SQL SERVER – Get a List of Fixed Hard Drive and Free Space on Server. I recently received excellent comment by MVP Ravikanth. He demonstrated that how the same can be done using Powershell. It is very sweet and quick solution.

Here is the powershell script. Run the same in your powershell windows.

Get-WmiObject -Class Win32_LogicalDisk | Select -Property DeviceID, @{Name=’FreeSpaceMB’;Expression={$_.FreeSpace/1MB} } | Format-Table -AutoSize

Well, I ran this script in my powershell window, it gave me following result – very accurately and easily.

Get-WmiObject -Class Win32_LogicalDisk | Select -Property DeviceID, @{Name=’FreeSpaceMB’;Expression={$_.FreeSpace/1MB} } | Format-Table -AutoSize

SQL SERVER - Powershell - Get a List of Fixed Hard Drive and Free Space on Server pssize

Thanks Ravikanth one more time for excellent tip.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Powershell, SQL Scripts, SQL Stored Procedure
Previous Post
SQL SERVER – Get Directory Structure using Extended Stored Procedure xp_dirtree
Next Post
SQLAuthority News – SafePeak’s SQL Server Performance Contest – Winners

Related Posts

Leave a Reply