Deployment Solution

 View Only
  • 1.  Email person depending on site server

    Posted Sep 11, 2013 05:47 AM

    At them moment I have a script that sends an email to all tech support guys when a build completes. I would like to set it up so that only specific contacts are mailed depending on what site server did the build. anyone have any ideas/scripts for this ?

    Ta.

     



  • 2.  RE: Email person depending on site server

    Posted Sep 13, 2013 11:46 AM

    OK, just in case anyone else is looking for something similar as the Email function in NS7.1 doesn't work in client jobs (wacky! i know) - heres the script I used. It mails whoever is responsible for that site server build. Now I'm not a scripter so I assume it can be done more efficiently. But hey - it works.

     

    Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
    Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

    Const cdoAnonymous = 0 'Do not authenticate
    Const cdoBasic = 1 'basic (clear-text) authentication
    Const cdoNTLM = 2 'NTLM

    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = "Subject of email goes here"
    objMessage.From = me@here.com

    IF UCase("%SSTOKEN%") = "server1" Then objMessage.TO = tech1@company.com
    IF UCase("%SSTOKEN%") = "server2" Then objMessage.TO = tech2@company.com
    ........repeat for each site server
     

    objMessage.BCC = BigTechHoncho@comapny.com


    objMessage.TextBody = "Body of mail text goes here "
     
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "MAILSERVER"
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoNTLM
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "domain\bigbob"
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    objMessage.Configuration.Fields.Update

    objMessage.Send

     

     

    I created a token for the site server (SSTOKEN) using this sql

     

    select c.name from TaskTargetDeviceCache vc left outer join Inv_Client_Task_Resources ctr on ctr._ResourceGuid = vc.Guid And vc.Guid = '%COMPUTERID%' left outer join Inv_Client_Task_Servers cts on cts.ClientTaskServerGuid = ctr.ClientTaskServerGuid Join vcomputer c on cts._ResourceGuid = c.guid