Alerting on free disk space for your SQL Server instance is not a base alert within DPA. This is because the information is not readily available from within the database instance via a query. However, using xp_cmdshell
and a PowerShell command, we can add a custom alert to DPA to handle this. Note: the xp_cmdshell
option is disabled by default on SQL Server instances. For this alert to work properly, xp_cmdshell
must be enabled.
When creating the alert in DPA, create a Custom Alert of type "Custom SQL Alert - Multiple Numeric Return".
The PowerShell script uses the Win32_Volume
object which supports mount points as well as standard drives.