I recently had a requirement to be able to email SCCM reports on a schedule in an environment without SQL reporting services. I achieved this by creating a VB script to create an email that has the report ASP page as the body of the email. The script I used and scheduled as a Windows scheduled task was:
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Computers that do NOT have ......"
objMessage.From = "from@email.address"
objMessage.To = "to@email.address"
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.server.address.here"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
'The line below shows how to send a webpage from a remote site
objMessage.CreateMHTMLBody "http://serverURL/SMSReporting_P00/Report.asp?ReportID=422"
objMessage.Send
Just change the variables for your environment.
a WordPress rating system
Related Articles
4 users responded in this post
My friend and scripting king Tao Yang (http://blog.tyang.org/) has rewritten the code to make it easier to changes variable:
$URL = “http://SERVERURL/SMSReporting_000/Report.asp?ReportID=68&variable=4.00.6487.2157&type=1″
$SMTPServer = “mail.domain.com”
$sendername = “SCCM”
$senderAddress = “Sccm@domain.com”
$Recipient = “user@domain.com”
$strSubject = “Test”
$ie = new-object -comobject InternetExplorer.Application
$ie.navigate($URL)
While ($ie.Busy)
{ Start-Sleep -Milliseconds 400 }
$doc = $ie.document
$strbody = $doc.body.outerhtml
$ie.quit()
$Sender = “`”$SenderName`” `”
$msg = new-Object -comobject “CDO.Message”;
$msg.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2
$msg.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = $SMTPServer
$msg.Configuration.Fields.item(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”) = 2
$msg.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25
$msg.Configuration.Fields.Update()
$msg.From = $Sender
$msg.To = $Recipient
$msg.Subject = $strSubject
$msg.HTMLBody = $strbody
$msg.Send()
a WordPress rating system
I get an invalid character on line 1.
a WordPress rating system
When you are doing what? More information?
a WordPress rating system
hi danovich,
Is there a way to find all SRS scheduled reports details such as(schdeule time, mail IDs configured, etc.)? Pls help as we have many reports scheduled and manual work will take very long time..
a WordPress rating system
Leave A Reply