Hello,
I'm currently working at a customer with lots and lots of DEV-machines connected to TFS.
I would like to scheduled following:
1. run AXBuild.exe with batch (or powershell) every night/week
2. If the AxCompileAll.html contains Errors <> 0 send e-mail.
The html file contains this if all is OK:
Compiler Error log : 2016-02-12
Errors : 0
Warnings : 0
Best Practice Deviations : 0
If errors:
Compiler Error log : 2016-02-18
Errors : 13
Warnings : 24
Best Practice Deviations : 0
The first step is easy. To send the AxCompileAll.html via e-mail etc with powershell is also doable.
BUT..my issue is that i need to filter out to only do actions if Errors <> 0.
Anyone have any solution for this or input?
If there is a way with Select-String to filter out this it would be the best solution I think. Tried that but have not found a way to do above yet.
This is my current ps script for this:
compile:
$ServerInstallDirectory = "C:\Program Files\Microsoft Dynamics AX\60\Server\DynamicsAX_STAGE"
& $ServerInstallDirectory\bin\axutil.exe schema
$ClientInstallDirectory = "C:\Program Files (x86)\Microsoft Dynamics AX\60\Client"
& $ServerInstallDirectory\bin\AXBuild.exe xppcompileall /aos=01 /workers=12 /nocleanup /altbin=$ClientInstallDirectory\Bin /compiler=$ServerInstallDirectory\bin\ax32serv.exe
$TargetFile = $ServerInstallDirectory + "\Log\AxCompileAll.html"
send e-mail:
$fromaddress = donotreply@mailserver.com
$toaddress = "Alert@customer.com"
#$bccaddress = ""
#$CCaddress = ""
$Subject = "Compile - Stage - Results"
$body = get-content .\content.htm
$attachment = "C:\Program Files\Microsoft Dynamics AX\60\Server\DynamicsAX_STAGE\Log\AxCompileAll.html"
$smtpserver = "mailserver"
####################################
if( (get-item "C:\Program Files\Microsoft Dynamics AX\60\Server\DynamicsAX_STAGE\Log\AxCompileAll.html").length -gt 105KB)
{
$message = new-object System.Net.Mail.MailMessage
$message.From = $fromaddress
$message.To.Add($toaddress)
#$message.CC.Add($CCaddress)
#$message.Bcc.Add($bccaddress)
$message.IsBodyHtml = $True
$message.Subject = $Subject
$attach = new-object Net.Mail.Attachment($attachment)
$message.Attachments.Add($attach)
$message.body = $body
$smtp = new-object Net.Mail.SmtpClient($smtpserver)
$smtp.Send($message)
}
(the length -gt 105KB is one way i use today to see what file size is the break even when the Error occur. In my case 105KB means 0 Errors. If Errors=3 the file size will be like 135kb)
BR
Peter Liliegren