Hi,
I am new to Scripting advance stuff so i have started a script using Vbscrip, which i would prefer to do and not a powershell script.
i would like to get 2 parameters from the event id 4265 (Account logon failures) but i am not sure how to get it with vbscript and would like some assistance on it.
the 2 Parameters i am looking for is found in the message part,
TargetUserName and TargetDomainName
i would like to use it to send an email to the service account owner, currently i am using SCOM to collect only the event and then i want to set it up to send the mail to the service accounts owner email address in AD.
Here is my script that i will do as a test, The email portion i have already configured i just like to get those 2 parameters so i can complete it.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery _
("SELECT * FROM Win32_NTLogEvent WHERE Logfile = 'Security'" _
& "AND EventCode = '4625'")
'Header of the Table
strBody = "<p>The following Accounts Password Expired</p>"& VbCrLf
'Contents of the script P1
strBody = strBody & "<table border=""2"" bordercolor=""2A8588"" cellspacing=""3""><Caption><b><u>Expires Password Notification</b></u></Caption><tr
align=""center""><td><b>User Account</b></td><td colspan=""2"">$PRARamaters with vbscript</td></tr><tr align=""center""><td><b>Domain</b><td
colspan=""2"">$PRARamaters with vbscript</td></td></tr><tr align=""center""><td><b>Status</b><td colspan=""2"">$PRARamaters with vbscript</td></tr>"& VbCrLf
'command to write file to the disk
objTextFile.WriteLine(strBody)
'SendMail settings below configured
Set objEmail = CreateObject("CDO.Message")
set objConf = CreateObject("CDO.Configuration")
objEmail.From = Assistance@Address.co.za
objEmail.To = "Mail@Address.co.za"
objEmail.Subject = "Expired Password"
objEmail.htmlbody = strBody
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Mail.contoso.com"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
Any Assistance will help.