![]() ![]() Add arguments (optional): -File "filepath to our script".Go to the "Actions" tab → New action with following parameters:.Run "Task Scheduler" → Create new schedule task → Enter its name → Triggers tab → New trigger → Set up the following options:.Send-MailMessage -From $From -To $To -SmtpServer $Server -Body "$Body" -Subject $Subject -Credential $Cred -Encoding $encoding,/p> $Body=Get-WinEvent -FilterHashtable | Select TimeCreated, machinename, Creator" e= | select-object -first 1 #Powershell command for filtering the security log about created scheduled task event $encoding = ::UTF8 #Setting encoding to UTF8 for message correct display $Cred = New-Object, $Pwd) #Sender account credentials #(Warning! Use a very restricted account for the sender, because the password stored in the script will be not encrypted) ![]() $Pwd = ConvertTo-SecureString "enterpassword" -AsPlainText –Force #Sender account password $From = # From whom we are sending an e-mail(add anonymous logon permission if needed) $Subject = "New Scheduled Task Has Been Created" # Message Subject
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |