This recipe shows how to list disks available for your SQL Server instance, how much is used, and how much is available.
Follow these steps to check the disk space usage:
Open PowerShell ISE as administrator.
Add the following script and run:
#get server list $servers = @("localhost") #this can come from a file instead of hardcoding #the servers #servers = Get-Content <filename> Get-WmiObject -ComputerName $servers -Class Win32_Volume | ForEach-Object { $drive = $_ $item = [PSCustomObject] @{ Name = $drive.Name DeviceType = switch ($drive.DriveType) { 0 {"Unknown"} 1 {"No Root Directory"} 2 {"Removable Disk"} 3 {"Local Disk"} 4 {"Network Drive"} 5 {"Compact Disk"} 6 {"RAM"} } SizeGB = "{0:N2}" -f ($drive.Capacity/1GB) FreeSpaceGB = "{0:N2...