Thanks Mike for your prompt reply
Im not a scripting guy at all so all help is much appreciated. What I need is that if the folder is older than a day or 2 etc it will either create an event or email a specific email address. Our monitoring software can monitor events and creates a ticket
it will also create a ticket from an email. If at all possible can you help with this and do i just run this as a batch file?.
Thanks again
It's good to start learning PowerShell - If you are IT Admin this is most required. I will guide you in this script.
Step 1: Read the code line by line and change the mail ID and SMTP address
$updated = $false
$from = "Monitoring Mail ID"
$to = "Monitoring Mail ID"
$SMTP = "Your Company SMTP ADDRESS or webmail URL"
$Subject = "Alert -From Sophos AntiVirus."
$body = "A file newer than 1 day old has been found."
Get-ChildItem 'C:\Program Files (x86)\Sophos\Sophos Anti-Virus'| ForEach {
If ($_.LastWriteTime -gt (Get-Date).AddDays(-2) ) {
$updated = $true}
}
If ($updated) { Send-MailMessage -From $from -to $to -SmtpServer $SMTP -Subject $Subject -Body $body}
Else { Write-Host 'New files not found' }
Step 2: Copy and Paste the Code in NotePad
Step 3: Save the File as AVAlert.PS1 in C:\Temp\
Step 4: Click Start and in search type PowerShell
Step 5: Right Click PowerShell Windows and Choose Run as Admin
Step 6: Run this code
Set-ExecutionPolicy RemoteSigned -ErrorAction SilentlyContinue
Step 7: Navigate to C:\Temp - Normal DOS Commands
Step 8: PS C:\Temp> .\AVAlert.PS1
Step 9: Push Enter
Let me know if you have any issues. as Jrv and Mike Suggested please do follow the link and nothing is harsh while learning.
Please shout if you need assiatance -