GET-IT: TEAMS DAY | 1-Day Free Virtual Conference all about Teams. Here on Petri.com - 8/12/20 GET-IT: TEAMS DAY - 8/12/20

Add Hostname variable in a vbs script

Home Forums Scripting Windows Script Host Add Hostname variable in a vbs script

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    L4ndy
    Member
    #151979

    Hi there,

    I’ve got the following script:

    Set objEmail = CreateObject(“CDO.Message”)
    objEmail.From = “[EMAIL=”[email protected]”][email protected]om[/EMAIL]”
    objEmail.To = “[EMAIL=”[email protected]”][email protected][/EMAIL]”
    objEmail.Subject = “Server down”
    objEmail.Textbody = “Server1 is no longer accessible over the network.”
    objEmail.Configuration.Fields.Item _
    (“[URL]http://schemas.microsoft.com/cdo/configuration/sendusing[/URL]”) = 2
    objEmail.Configuration.Fields.Item _
    (“[URL]http://schemas.microsoft.com/cdo/configuration/smtpserver[/URL]”) = _
    “smarthost”
    objEmail.Configuration.Fields.Item _
    (“[URL]http://schemas.microsoft.com/cdo/configuration/smtpserverport[/URL]”) = 25
    objEmail.Configuration.Fields.Update
    objEmail.Send

    [/CODE]

    I need to put in a variable of the hostname in either the Subject title or in the text body.
    I believe strHostName can be used but I don’t know how.

    Can anyone help?

    Tia[CODE]
    Set objEmail = CreateObject(“CDO.Message”)
    objEmail.From = “[email protected]
    objEmail.To = “[email protected]
    objEmail.Subject = “Server down”
    objEmail.Textbody = “Server1 is no longer accessible over the network.”
    objEmail.Configuration.Fields.Item _
    (“http://schemas.microsoft.com/cdo/configuration/sendusing“) = 2
    objEmail.Configuration.Fields.Item _
    (“http://schemas.microsoft.com/cdo/configuration/smtpserver“) = _
    “smarthost”
    objEmail.Configuration.Fields.Item _
    (“http://schemas.microsoft.com/cdo/configuration/smtpserverport“) = 25
    objEmail.Configuration.Fields.Update
    objEmail.Send

    [/CODE]

    I need to put in a variable of the hostname in either the Subject title or in the text body.
    I believe strHostName can be used but I don’t know how.

    Can anyone help?

    Tia

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.