Jump to content


  • 0
thadkew

Send Email after OSD Tasks

Question

I've tried the instructions here with no success (there's no Task Sequence Manager component) and I tried taking the VBScript and adding it as a "run command prompt" task to the end of a OSD Task.

 

What's the best way to have an email sent out after a deployment is successful (like MDT 2010 can do)

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I don't know if this will help anyone, but here's something I threw together after scouring the googles...

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set objAdsSystemInfo = CreateObject("adsysteminfo")

Set objComputername = Getobject("LDAP://" & objAdsSystemInfo.ComputerName)

Set colServiceList = objWMIService.ExecQuery _

("Select * from Win32_Service where Name = 'PortBlock Service'")

 

strHostName = UCase(replace(objComputerName.Name,"CN=",""))

 

For Each objService in colServiceList

If objService.State = "Running" Then

objService.StopService()

Wscript.Sleep 5000

End If

errReturnCode = objService.ChangeStartMode("Automatic")

Next

 

Set objMessage = CreateObject("CDO.Message")

 

objMessage.Subject = "SCCM OS deployment has completed" & " " & strHostName

objMessage.From = "SCCM_Server@domain.com"

objMessage.To = "my_email@domain.com"

objMessage.TextBody = "This attachement Contains the Parsed log files" & vbcrlf & "Please review its contents"

objMessage.AddAttachment "c:\windows\system32\ccm\logs\smsts.log"

objMessage.Configuration.Fields.Item _

("
) = 2

objMessage.Configuration.Fields.Item _

("
) = _

"smtp.domain.com"

objMessage.Configuration.Fields.Item _

("
) = 25

objMessage.Configuration.Fields.Update

objMessage.Send

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

 

Set colServiceList = objWMIService.ExecQuery _

("Select * from Win32_Service where Name = 'PortBlock Service'")

 

For Each objService in colServiceList

If objService.State = "Stopped" Then

objService.StartService()

Wscript.Sleep 5000

End If

errReturnCode = objService.ChangeStartMode("Automatic")

Next

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.