I have a program creating a huge log file when importing new data. The server ran out of space very often. I use the new cmdlet “Register-WMIEvent” in CTP 2 to monitor the hard disk space and run some clean up when out of space.
Register-WMIEvent -query “SELECT * from __InstanceModificationEvent within 60 Where TargetInstance ISA ‘Win32_LogicalDisk’ AND TargetInstance.freespace < 1000000 AND TargetInstance.DeviceID = ‘D:’” `
-sourceIdentifier “Disk Cleanup” –action {Write-Host “Free up space.”}