none
SCCM Email Notification Upon Failure and Success - Wont display correct host name in Email. RRS feed

  • Question

  • Having followed the guidlines laid down in this very helpfull Blog below im now hitting an issue.

    http://scug.be/sccm/2010/10/01/configmgr-osd-task-sequence-success-or-failure-notification/

    The emails are arriving OK on failure or sucess but it reports back the initial MININTXXXX Host name Instead of the Host name I set using the variables within the script (%deployroot%\scripts\ztitatoo.wsf) - (shown below)

    oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Deployment 4\OSD Advertisement ID", oEnvironment.Item("_SMSTSAdvertID")
       oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\NYCC\Asset Information\Computer Name", oEnvironment.Item("OSDComputerName")
       oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\NYCC\Asset Information\Site Code", oEnvironment.Item("OSDSiteCode")

    Gathered by the collection Variables below.

    It Should report back with a Host name of NY123456. (The build engineer provides this upon rebuild)

    This is a full wipe and deploy method using Nework driven USB sticks

    Ive tryed both Machinename & OSDMachinename variables within the Powershell Script triggered by the status filter rules to no Avail.

    Any Ideas. ??


    Tuesday, June 4, 2013 8:29 AM

Answers

  • I have used this status filter rule. In the mail you would get the computer name whatever is in the Status messages.

    By the time your machine is built with success code 11143, the computer name could be MININTXXXX and that is why you have that in the mail.

    Regards,

    Manohar Pusala

    • Marked as answer by Juke Chou Tuesday, June 18, 2013 2:34 PM
    Thursday, June 13, 2013 12:17 PM
  • Unfortunately the trigger i am activating the email from has the host name of the machine set to the winpe instance. so i need to identifiy a unique trigger which has the correct host name of the machine but unfortunately i cant seem to fine a suitable one.

    I have made do with a link back the he task sequence report. and ive also incorporated the MDT OSD Results app at the end of the task sequence.

    So this gives a visual success or failure that doesn't disapear after 15 mins.

    This looks like a limitation of the system based on my needs. no big deal.

    Thursday, June 27, 2013 10:16 AM

All replies

  • I haven't used that personally.  But looking at the status filter rule and powershell script; all I can suggest is that you from the console, go look at what is actually inside the results for those particular triggers.  I suspect that it's reporting exactly what the client is sending--that minit name.  You'll just have to look and see what's in there.

    Standardize. Simplify. Automate.

    Wednesday, June 12, 2013 2:21 PM
    Moderator
  • I have used this status filter rule. In the mail you would get the computer name whatever is in the Status messages.

    By the time your machine is built with success code 11143, the computer name could be MININTXXXX and that is why you have that in the mail.

    Regards,

    Manohar Pusala

    • Marked as answer by Juke Chou Tuesday, June 18, 2013 2:34 PM
    Thursday, June 13, 2013 12:17 PM
  • Unfortunately the trigger i am activating the email from has the host name of the machine set to the winpe instance. so i need to identifiy a unique trigger which has the correct host name of the machine but unfortunately i cant seem to fine a suitable one.

    I have made do with a link back the he task sequence report. and ive also incorporated the MDT OSD Results app at the end of the task sequence.

    So this gives a visual success or failure that doesn't disapear after 15 mins.

    This looks like a limitation of the system based on my needs. no big deal.

    Thursday, June 27, 2013 10:16 AM
  • I know this is an old post, but I just stumbled upon it now.

    I added this piece of code to resolve the SCCM system name to IP anddress and then from IP to DNS hostname.  Code needs to go in just after "$erroractionpreference =" and before "$strSMTP = "

    # Convert SCCM system name to DNS Hostname by resolving IP
    $ping = New-Object System.Net.NetworkInformation.Ping
    $ips = $($ping.Send($strComputerName).Address).IPAddressToString
    $result = $null    
    $result = [System.Net.Dns]::gethostentry($ips)
    $strComputerName = $result.HostName.TrimEnd("Your Domain Name Goes In Here")



    Monday, May 11, 2015 1:43 AM
  • Craig

    I have tried adding your code snippet 

    $ping = New-Object System.Net.NetworkInformation.Ping
    $ips = $($ping.Send($strComputerName).Address).IPAddressToString
    $result = $null    
    $result = [System.Net.Dns]::gethostentry($ips)
    $strComputerName = $result.HostName.TrimEnd("Your Domain Name Goes In Here")

    when testing i get 

    Exception calling "Send" with "1" argument(s): "Value cannot be null.
    Parameter name: hostNameOrAddress"
    At E:\Sources\Scripts\OSDSUCCESSV2.ps1:42 char:11
    +  $ips = $($ping.Send($strComputerName).Address).IPAddressToString
    +           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ArgumentNullException
     
    Exception calling "GetHostEntry" with "1" argument(s): "Value cannot be null.
    Parameter name: address"
    At E:\Sources\Scripts\OSDSUCCESSV2.ps1:44 char:2
    +  $result = [System.Net.Dns]::gethostentry($ips)
    +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ArgumentNullException
     
    You cannot call a method on a null-valued expression.
    At E:\Sources\Scripts\OSDSUCCESSV2.ps1:45 char:2
    +  $strComputerName = $result.HostName.TrimEnd("waingelsc.internal")
    +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull

    Did you get this to work? I cant seem to get it to work?

    Friday, August 2, 2019 7:29 AM