I added a basic powershell script to monitor filesize and send e-mail.
#Abdurrahim YILDIRIM# #Define file that you need to monitor#### $targetFile = "C:\HPOM\ProgramData\HP\HP BTO Software\shared\tmp\queues\MsgQueue" $path_file = "C:\HPOOconfig\SystemControl\quee_size_control" $fileSize = ((Get-Item $targetFile).length/1KB) $friendlySize = ([math]::Round($fileSize, 2)) $sto = "yourmail@casesup.com" echo $fileSize if ($fileSize -gt 100) { if (Test-Path $path_file) { echo $fileSize >> $path_file } else { echo $fileSize >> $path_file Send-MailMessage -To $sto -From localmachine@test.com -SMTPServer smtpx.casesup.com -Subject "FileMonitor - Alert " -Body "$targetFile file size $friendlySize KB." } } else { if (Test-Path $path_file) { Send-MailMessage -To $sto -From localmachine@test.com -SMTPServer smtpx.casesup.com -Subject "FileMonitor - Alert " -Body "$targetFile file size $friendlySize KB." del $path_file } }
Tagged In: