remote monitoring win server disk spaces

You have a couple of windows server with many disks. You want to know the current disk usage of each disk, to avoid out of space errors. Servers are added and removed dynamically - so it should be possible to mangage the solution on a single server.

Taggings:

1 answer

Power shell script

Windows PowerShell is Microsofts solution for automate administative tasks on local or remote Windows systems. The task are written in PowerShell scripts and executed on the command line.

The solution of the problem is to write a script, that remote connects to each target server and read out the disk size and free space of each disk. The script sends the result to an email adress.
The monitored servers are saved in an txt file. The script is sceduled by the windows task scheduler once a day.

The interesting part of the script

foreach($server in $servers)
{
$disks = Get-WmiObject -ComputerName $server -Class Win32_LogicalDisk;
foreach($disk in $disks)
{
$size = $disk.Size;
$freespace = $disk.FreeSpace;
}
}

This information can be outputed directly or further processed by the script

This information can be outputed or