Results 1 to 8 of 8

Thread: What is error '80041003', please?

  1. #1
    SteveH Guest

    What is error '80041003', please?

    Hello

    I am getting an '80041003' error, but I'm not sure what it means.

    Here is the script:

    <%@ LANGUAGE="VBSCRIPT" %>
    <%
    ' Please indicate where notifications should be sent
    Const ADMIN_EMAIL = "myEmail@whatever.com"

    ' Please provide the following details for your SMTP server
    Const SMTP_SERVER="mail.whatever.com"
    Const SMTP_PORT = 25 ' Do not change if you are unsure

    ' If your SMTP server requires authentication, please set
    ' USE_AUTHENTICATION to True and supply a username and password
    Const USE_AUTHENTICATION = True
    Const SMTP_USER="whatever@whatever.com"
    Const SMTP_PASS="name"

    ' If your SMTP server uses Secure Password Aunthentication, please
    ' set the following value to True.
    Const SMTP_SSL = False

    ' Set this value to true while testing
    Const ENABLE_DEBUGGING = False

    ' Do not change anything below this line
    Set WshNetwork = CreateObject("WScript.Network")

    dteTime = Time
    dteDate = Date

    strMessage = "A user has logged onto <b>" & ComputerName & "</b> from <b>" &
    WAN_IP & "</b> with the following details:<br><br>" _
    & "Logon Date: " & dteDate & "<br>" _
    & "Logon Time: " & dteTime & "<br>" _
    & "Account Name: " & AccountName & "<br>" _
    & "LAN IP: " & LAN_IP & "<br>"

    result = SendMail(strMessage)

    If ENABLE_DEBUGGING Then WScript.Echo result
    WScript.Quit

    Function AccountName
    If IsNull(WshNetwork) Then Set WshNetwork = CreateObject("WScript.Network")
    AccountName = WshNetwork.UserName

    End Function

    Function ComputerName
    If IsNull(WshNetwork) Then Set WshNetwork = CreateObject("WScript.Network")
    ComputerName = WshNetwork.ComputerName

    End Function

    Function LAN_IP
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select IPAddress from
    Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)

    For Each objItem In colItems
    If Not IsNull(objItem.IPAddress) Then
    LAN_IP = objItem.IPAddress(0)
    Exit For
    End If
    Next

    End Function

    Function WAN_IP
    Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP")
    Call objxmlHTTP.open("get", "http://checkip.dyndns.org", False)
    objxmlHTTP.Send()

    strHTMLText = objxmlHTTP.ResponseText
    Set objxmlHTTP = Nothing

    If strHTMLText <> "" Then
    varStart = InStr(1, strHTMLText, "Current IP Address:", vbTextCompare) + 19
    If varStart Then varStop = InStr(varStart, strHTMLText, "</body>",
    vbTextCompare)
    If varStart And varStop Then strIP = Mid(strHTMLText, varStart, varStop -
    varStart)

    Else
    strIP = "Unavailable"

    End If
    WAN_IP = Trim(strIP)

    End Function

    Function SendMail(strBody)
    Set objEmail = CreateObject("CDO.Message")
    With objEmail
    .From = ADMIN_EMAIL
    .To = ADMIN_EMAIL
    .Subject = "Logon Notification"
    .HTMLBody = strBody
    .Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_SERVER
    .Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    SMTP_PORT
    If USE_AUTHENTICATION Then
    .Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusername") =
    SMTP_USER
    .Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
    SMTP_PASS

    End If
    If SMTP_SSL Then
    .Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

    End If
    .Configuration.Fields.Update

    On Error Resume Next
    Err.Clear

    .Send

    If Err.number <> 0 Then
    SendMail = Err.Description

    Else
    SendMail = "The server did not return any errors."

    End If
    On Error Goto 0

    End With

    End Function
    %>

    Is there anything obvious here which is responsible for the error I am
    getting?

    Many thanks.

    Steve

  2. #2
    urkec Guest

    RE: What is error '80041003', please?

    "SteveH" wrote:

    > Hello
    >
    > I am getting an '80041003' error, but I'm not sure what it means.
    >
    > Here is the script:
    >
    > <%@ LANGUAGE="VBSCRIPT" %>
    > <%
    > ' Please indicate where notifications should be sent
    > Const ADMIN_EMAIL = "myEmail@whatever.com"
    >
    > ' Please provide the following details for your SMTP server
    > Const SMTP_SERVER="mail.whatever.com"
    > Const SMTP_PORT = 25 ' Do not change if you are unsure
    >
    > ' If your SMTP server requires authentication, please set
    > ' USE_AUTHENTICATION to True and supply a username and password
    > Const USE_AUTHENTICATION = True
    > Const SMTP_USER="whatever@whatever.com"
    > Const SMTP_PASS="name"
    >
    > ' If your SMTP server uses Secure Password Aunthentication, please
    > ' set the following value to True.
    > Const SMTP_SSL = False
    >
    > ' Set this value to true while testing
    > Const ENABLE_DEBUGGING = False
    >
    > ' Do not change anything below this line
    > Set WshNetwork = CreateObject("WScript.Network")
    >
    > dteTime = Time
    > dteDate = Date
    >
    > strMessage = "A user has logged onto <b>" & ComputerName & "</b> from <b>" &
    > WAN_IP & "</b> with the following details:<br><br>" _
    > & "Logon Date: " & dteDate & "<br>" _
    > & "Logon Time: " & dteTime & "<br>" _
    > & "Account Name: " & AccountName & "<br>" _
    > & "LAN IP: " & LAN_IP & "<br>"
    >
    > result = SendMail(strMessage)
    >
    > If ENABLE_DEBUGGING Then WScript.Echo result
    > WScript.Quit
    >
    > Function AccountName
    > If IsNull(WshNetwork) Then Set WshNetwork = CreateObject("WScript.Network")
    > AccountName = WshNetwork.UserName
    >
    > End Function
    >
    > Function ComputerName
    > If IsNull(WshNetwork) Then Set WshNetwork = CreateObject("WScript.Network")
    > ComputerName = WshNetwork.ComputerName
    >
    > End Function
    >
    > Function LAN_IP
    > strComputer = "."
    > Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    > Set colItems = objWMIService.ExecQuery("Select IPAddress from
    > Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    >
    > For Each objItem In colItems
    > If Not IsNull(objItem.IPAddress) Then
    > LAN_IP = objItem.IPAddress(0)
    > Exit For
    > End If
    > Next
    >
    > End Function
    >
    > Function WAN_IP
    > Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP")
    > Call objxmlHTTP.open("get", "http://checkip.dyndns.org", False)
    > objxmlHTTP.Send()
    >
    > strHTMLText = objxmlHTTP.ResponseText
    > Set objxmlHTTP = Nothing
    >
    > If strHTMLText <> "" Then
    > varStart = InStr(1, strHTMLText, "Current IP Address:", vbTextCompare) + 19
    > If varStart Then varStop = InStr(varStart, strHTMLText, "</body>",
    > vbTextCompare)
    > If varStart And varStop Then strIP = Mid(strHTMLText, varStart, varStop -
    > varStart)
    >
    > Else
    > strIP = "Unavailable"
    >
    > End If
    > WAN_IP = Trim(strIP)
    >
    > End Function
    >
    > Function SendMail(strBody)
    > Set objEmail = CreateObject("CDO.Message")
    > With objEmail
    > .From = ADMIN_EMAIL
    > .To = ADMIN_EMAIL
    > .Subject = "Logon Notification"
    > .HTMLBody = strBody
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_SERVER
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    > SMTP_PORT
    > If USE_AUTHENTICATION Then
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/sendusername") =
    > SMTP_USER
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
    > SMTP_PASS
    >
    > End If
    > If SMTP_SSL Then
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    >
    > End If
    > .Configuration.Fields.Update
    >
    > On Error Resume Next
    > Err.Clear
    >
    > .Send
    >
    > If Err.number <> 0 Then
    > SendMail = Err.Description
    >
    > Else
    > SendMail = "The server did not return any errors."
    >
    > End If
    > On Error Goto 0
    >
    > End With
    >
    > End Function
    > %>
    >
    > Is there anything obvious here which is responsible for the error I am
    > getting?
    >
    > Many thanks.
    >
    > Steve



    Access denied:

    http://msdn.microsoft.com/en-us/libr...78(VS.85).aspx

    --
    urkec

  3. #3
    Tom Lavedas Guest

    Re: What is error '80041003', please?

    On Nov 17, 6:14 am, SteveH <Ste...@discussions.microsoft.com> wrote:
    > Hello
    >
    > I am getting an '80041003' error, but I'm not sure what it means.
    >
    > Here is the script:
    >
    > <%@ LANGUAGE="VBSCRIPT" %>

    {snip}
    >
    > Is there anything obvious here which is responsible for the error I am
    > getting?
    >
    > Many thanks.
    >
    > Steve


    I searched MSDN and found '80041003 is WBEM_E_ACCESS_DENIED wmi error
    number which means "The current user does not have permission to
    perform the action"'. It appears this is in an ASP, so the obvious
    issue is that the webserver user does not have access (permission) to
    what you are trying to do. Since you don't say what line is reported
    for the error, it's hard to say exactly where the problem is.

    BTW, the WSCRIPT object (as in Wscript.Echo and Wscript.quit) is not
    supported in hosts other than the Windows Script Host (wscript.exe or
    cscript.exe).

    Tom Lavedas
    ***********
    http://there.is.no.more/tglbatch/

  4. #4
    SteveH Guest

    RE: What is error '80041003', please?

    Many thanks to you both for your replies.

    I'm unsure about what the message means that I do not have the necessary
    permissions. I can ask my Web hosting service, but as far as I know I have
    read/write permissions in that I own the site.

    This might be one of those errors which the Windows server throws up as the
    closest it can find to pinpointing an error.

    The exact error is this:

    error '80041003'
    /LogInTest/notification.asp, line 54


    When it points to a line I'm never sure if space are included or if
    commented lines are included.

    Thanks for your help again.

    Steve

















    "SteveH" wrote:

    > Hello
    >
    > I am getting an '80041003' error, but I'm not sure what it means.
    >
    > Here is the script:
    >
    > <%@ LANGUAGE="VBSCRIPT" %>
    > <%
    > ' Please indicate where notifications should be sent
    > Const ADMIN_EMAIL = "myEmail@whatever.com"
    >
    > ' Please provide the following details for your SMTP server
    > Const SMTP_SERVER="mail.whatever.com"
    > Const SMTP_PORT = 25 ' Do not change if you are unsure
    >
    > ' If your SMTP server requires authentication, please set
    > ' USE_AUTHENTICATION to True and supply a username and password
    > Const USE_AUTHENTICATION = True
    > Const SMTP_USER="whatever@whatever.com"
    > Const SMTP_PASS="name"
    >
    > ' If your SMTP server uses Secure Password Aunthentication, please
    > ' set the following value to True.
    > Const SMTP_SSL = False
    >
    > ' Set this value to true while testing
    > Const ENABLE_DEBUGGING = False
    >
    > ' Do not change anything below this line
    > Set WshNetwork = CreateObject("WScript.Network")
    >
    > dteTime = Time
    > dteDate = Date
    >
    > strMessage = "A user has logged onto <b>" & ComputerName & "</b> from <b>" &
    > WAN_IP & "</b> with the following details:<br><br>" _
    > & "Logon Date: " & dteDate & "<br>" _
    > & "Logon Time: " & dteTime & "<br>" _
    > & "Account Name: " & AccountName & "<br>" _
    > & "LAN IP: " & LAN_IP & "<br>"
    >
    > result = SendMail(strMessage)
    >
    > If ENABLE_DEBUGGING Then WScript.Echo result
    > WScript.Quit
    >
    > Function AccountName
    > If IsNull(WshNetwork) Then Set WshNetwork = CreateObject("WScript.Network")
    > AccountName = WshNetwork.UserName
    >
    > End Function
    >
    > Function ComputerName
    > If IsNull(WshNetwork) Then Set WshNetwork = CreateObject("WScript.Network")
    > ComputerName = WshNetwork.ComputerName
    >
    > End Function
    >
    > Function LAN_IP
    > strComputer = "."
    > Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    > Set colItems = objWMIService.ExecQuery("Select IPAddress from
    > Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    >
    > For Each objItem In colItems
    > If Not IsNull(objItem.IPAddress) Then
    > LAN_IP = objItem.IPAddress(0)
    > Exit For
    > End If
    > Next
    >
    > End Function
    >
    > Function WAN_IP
    > Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP")
    > Call objxmlHTTP.open("get", "http://checkip.dyndns.org", False)
    > objxmlHTTP.Send()
    >
    > strHTMLText = objxmlHTTP.ResponseText
    > Set objxmlHTTP = Nothing
    >
    > If strHTMLText <> "" Then
    > varStart = InStr(1, strHTMLText, "Current IP Address:", vbTextCompare) + 19
    > If varStart Then varStop = InStr(varStart, strHTMLText, "</body>",
    > vbTextCompare)
    > If varStart And varStop Then strIP = Mid(strHTMLText, varStart, varStop -
    > varStart)
    >
    > Else
    > strIP = "Unavailable"
    >
    > End If
    > WAN_IP = Trim(strIP)
    >
    > End Function
    >
    > Function SendMail(strBody)
    > Set objEmail = CreateObject("CDO.Message")
    > With objEmail
    > .From = ADMIN_EMAIL
    > .To = ADMIN_EMAIL
    > .Subject = "Logon Notification"
    > .HTMLBody = strBody
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_SERVER
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    > SMTP_PORT
    > If USE_AUTHENTICATION Then
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/sendusername") =
    > SMTP_USER
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
    > SMTP_PASS
    >
    > End If
    > If SMTP_SSL Then
    > .Configuration.Fields.Item _
    > ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    >
    > End If
    > .Configuration.Fields.Update
    >
    > On Error Resume Next
    > Err.Clear
    >
    > .Send
    >
    > If Err.number <> 0 Then
    > SendMail = Err.Description
    >
    > Else
    > SendMail = "The server did not return any errors."
    >
    > End If
    > On Error Goto 0
    >
    > End With
    >
    > End Function
    > %>
    >
    > Is there anything obvious here which is responsible for the error I am
    > getting?
    >
    > Many thanks.
    >
    > Steve


  5. #5
    Richard Mueller [MVP] Guest

    Re: What is error '80041003', please?

    My best estimate is that line 54 is the following (watch line wrapping):

    Set colItems = objWMIService.ExecQuery("Select IPAddress from
    Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)

    If this is correct, it appears you have permission to connect to the
    computer, but not to use the Win32_NetworkAdapterConfiguration class of WMI.

    Or, if the error is raised on the previous line (which seems more likely),
    you cannot connect with WMI. Instead of the following:

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

    I would suggest you try:

    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    & strComputer & "\root\cimv2")

    Refer to the following links to troubleshoot WMI:

    http://www.microsoft.com/technet/scr.../help/wmi.mspx

    http://support.microsoft.com/kb/875605

    http://www.microsoft.com/technet/scr...es/wmifaq.mspx

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --
    "SteveH" <SteveH@discussions.microsoft.com> wrote in message
    news:FF252308-8B5F-48E7-8286-5075A1A71836@microsoft.com...
    > Many thanks to you both for your replies.
    >
    > I'm unsure about what the message means that I do not have the necessary
    > permissions. I can ask my Web hosting service, but as far as I know I have
    > read/write permissions in that I own the site.
    >
    > This might be one of those errors which the Windows server throws up as
    > the
    > closest it can find to pinpointing an error.
    >
    > The exact error is this:
    >
    > error '80041003'
    > /LogInTest/notification.asp, line 54
    >
    >
    > When it points to a line I'm never sure if space are included or if
    > commented lines are included.
    >
    > Thanks for your help again.
    >
    > Steve
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > "SteveH" wrote:
    >
    >> Hello
    >>
    >> I am getting an '80041003' error, but I'm not sure what it means.
    >>
    >> Here is the script:
    >>
    >> <%@ LANGUAGE="VBSCRIPT" %>
    >> <%
    >> ' Please indicate where notifications should be sent
    >> Const ADMIN_EMAIL = "myEmail@whatever.com"
    >>
    >> ' Please provide the following details for your SMTP server
    >> Const SMTP_SERVER="mail.whatever.com"
    >> Const SMTP_PORT = 25 ' Do not change if you are unsure
    >>
    >> ' If your SMTP server requires authentication, please set
    >> ' USE_AUTHENTICATION to True and supply a username and password
    >> Const USE_AUTHENTICATION = True
    >> Const SMTP_USER="whatever@whatever.com"
    >> Const SMTP_PASS="name"
    >>
    >> ' If your SMTP server uses Secure Password Aunthentication, please
    >> ' set the following value to True.
    >> Const SMTP_SSL = False
    >>
    >> ' Set this value to true while testing
    >> Const ENABLE_DEBUGGING = False
    >>
    >> ' Do not change anything below this line
    >> Set WshNetwork = CreateObject("WScript.Network")
    >>
    >> dteTime = Time
    >> dteDate = Date
    >>
    >> strMessage = "A user has logged onto <b>" & ComputerName & "</b> from
    >> <b>" &
    >> WAN_IP & "</b> with the following details:<br><br>" _
    >> & "Logon Date: " & dteDate & "<br>" _
    >> & "Logon Time: " & dteTime & "<br>" _
    >> & "Account Name: " & AccountName & "<br>" _
    >> & "LAN IP: " & LAN_IP & "<br>"
    >>
    >> result = SendMail(strMessage)
    >>
    >> If ENABLE_DEBUGGING Then WScript.Echo result
    >> WScript.Quit
    >>
    >> Function AccountName
    >> If IsNull(WshNetwork) Then Set WshNetwork =
    >> CreateObject("WScript.Network")
    >> AccountName = WshNetwork.UserName
    >>
    >> End Function
    >>
    >> Function ComputerName
    >> If IsNull(WshNetwork) Then Set WshNetwork =
    >> CreateObject("WScript.Network")
    >> ComputerName = WshNetwork.ComputerName
    >>
    >> End Function
    >>
    >> Function LAN_IP
    >> strComputer = "."
    >> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
    >> "\root\cimv2")
    >> Set colItems = objWMIService.ExecQuery("Select IPAddress from
    >> Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    >>
    >> For Each objItem In colItems
    >> If Not IsNull(objItem.IPAddress) Then
    >> LAN_IP = objItem.IPAddress(0)
    >> Exit For
    >> End If
    >> Next
    >>
    >> End Function
    >>
    >> Function WAN_IP
    >> Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP")
    >> Call objxmlHTTP.open("get", "http://checkip.dyndns.org", False)
    >> objxmlHTTP.Send()
    >>
    >> strHTMLText = objxmlHTTP.ResponseText
    >> Set objxmlHTTP = Nothing
    >>
    >> If strHTMLText <> "" Then
    >> varStart = InStr(1, strHTMLText, "Current IP Address:", vbTextCompare) +
    >> 19
    >> If varStart Then varStop = InStr(varStart, strHTMLText, "</body>",
    >> vbTextCompare)
    >> If varStart And varStop Then strIP = Mid(strHTMLText, varStart, varStop -
    >> varStart)
    >>
    >> Else
    >> strIP = "Unavailable"
    >>
    >> End If
    >> WAN_IP = Trim(strIP)
    >>
    >> End Function
    >>
    >> Function SendMail(strBody)
    >> Set objEmail = CreateObject("CDO.Message")
    >> With objEmail
    >> .From = ADMIN_EMAIL
    >> .To = ADMIN_EMAIL
    >> .Subject = "Logon Notification"
    >> .HTMLBody = strBody
    >> .Configuration.Fields.Item _
    >> ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    >> .Configuration.Fields.Item _
    >> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
    >> SMTP_SERVER
    >> .Configuration.Fields.Item _
    >> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    >> SMTP_PORT
    >> If USE_AUTHENTICATION Then
    >> .Configuration.Fields.Item _
    >> ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    >> .Configuration.Fields.Item _
    >> ("http://schemas.microsoft.com/cdo/configuration/sendusername") =
    >> SMTP_USER
    >> .Configuration.Fields.Item _
    >> ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
    >> SMTP_PASS
    >>
    >> End If
    >> If SMTP_SSL Then
    >> .Configuration.Fields.Item _
    >> ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    >>
    >> End If
    >> .Configuration.Fields.Update
    >>
    >> On Error Resume Next
    >> Err.Clear
    >>
    >> .Send
    >>
    >> If Err.number <> 0 Then
    >> SendMail = Err.Description
    >>
    >> Else
    >> SendMail = "The server did not return any errors."
    >>
    >> End If
    >> On Error Goto 0
    >>
    >> End With
    >>
    >> End Function
    >> %>
    >>
    >> Is there anything obvious here which is responsible for the error I am
    >> getting?
    >>
    >> Many thanks.
    >>
    >> Steve




  6. #6
    SteveH Guest

    Re: What is error '80041003', please?

    Hello Richard

    Many thanks for your post.

    When I try this:

    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    & strComputer & "\root\cimv2")

    and comment out

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

    I get the same error message:

    error '80041003'
    /LogInTest/notification.asp, line 58

    Would that suggest I do not have permission to use:

    Win32_NetworkAdapterConfiguration class of WMI

    Do I need to contact the hosting service to correct that, or is there
    another way to resolve it?

    Cheers again, Richard.

    Steve


    "Richard Mueller [MVP]" wrote:

    > My best estimate is that line 54 is the following (watch line wrapping):
    >
    > Set colItems = objWMIService.ExecQuery("Select IPAddress from
    > Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    >
    > If this is correct, it appears you have permission to connect to the
    > computer, but not to use the Win32_NetworkAdapterConfiguration class of WMI.
    >
    > Or, if the error is raised on the previous line (which seems more likely),
    > you cannot connect with WMI. Instead of the following:
    >
    > Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    >
    > I would suggest you try:
    >
    > Set objWMIService = GetObject("winmgmts:" _
    > & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    > & strComputer & "\root\cimv2")
    >
    > Refer to the following links to troubleshoot WMI:
    >
    > http://www.microsoft.com/technet/scr.../help/wmi.mspx
    >
    > http://support.microsoft.com/kb/875605
    >
    > http://www.microsoft.com/technet/scr...es/wmifaq.mspx
    >
    > --
    > Richard Mueller
    > MVP Directory Services
    > Hilltop Lab - http://www.rlmueller.net
    > --
    > "SteveH" <SteveH@discussions.microsoft.com> wrote in message
    > news:FF252308-8B5F-48E7-8286-5075A1A71836@microsoft.com...
    > > Many thanks to you both for your replies.
    > >
    > > I'm unsure about what the message means that I do not have the necessary
    > > permissions. I can ask my Web hosting service, but as far as I know I have
    > > read/write permissions in that I own the site.
    > >
    > > This might be one of those errors which the Windows server throws up as
    > > the
    > > closest it can find to pinpointing an error.
    > >
    > > The exact error is this:
    > >
    > > error '80041003'
    > > /LogInTest/notification.asp, line 54
    > >
    > >
    > > When it points to a line I'm never sure if space are included or if
    > > commented lines are included.
    > >
    > > Thanks for your help again.
    > >
    > > Steve
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > "SteveH" wrote:
    > >
    > >> Hello
    > >>
    > >> I am getting an '80041003' error, but I'm not sure what it means.
    > >>
    > >> Here is the script:
    > >>
    > >> <%@ LANGUAGE="VBSCRIPT" %>
    > >> <%
    > >> ' Please indicate where notifications should be sent
    > >> Const ADMIN_EMAIL = "myEmail@whatever.com"
    > >>
    > >> ' Please provide the following details for your SMTP server
    > >> Const SMTP_SERVER="mail.whatever.com"
    > >> Const SMTP_PORT = 25 ' Do not change if you are unsure
    > >>
    > >> ' If your SMTP server requires authentication, please set
    > >> ' USE_AUTHENTICATION to True and supply a username and password
    > >> Const USE_AUTHENTICATION = True
    > >> Const SMTP_USER="whatever@whatever.com"
    > >> Const SMTP_PASS="name"
    > >>
    > >> ' If your SMTP server uses Secure Password Aunthentication, please
    > >> ' set the following value to True.
    > >> Const SMTP_SSL = False
    > >>
    > >> ' Set this value to true while testing
    > >> Const ENABLE_DEBUGGING = False
    > >>
    > >> ' Do not change anything below this line
    > >> Set WshNetwork = CreateObject("WScript.Network")
    > >>
    > >> dteTime = Time
    > >> dteDate = Date
    > >>
    > >> strMessage = "A user has logged onto <b>" & ComputerName & "</b> from
    > >> <b>" &
    > >> WAN_IP & "</b> with the following details:<br><br>" _
    > >> & "Logon Date: " & dteDate & "<br>" _
    > >> & "Logon Time: " & dteTime & "<br>" _
    > >> & "Account Name: " & AccountName & "<br>" _
    > >> & "LAN IP: " & LAN_IP & "<br>"
    > >>
    > >> result = SendMail(strMessage)
    > >>
    > >> If ENABLE_DEBUGGING Then WScript.Echo result
    > >> WScript.Quit
    > >>
    > >> Function AccountName
    > >> If IsNull(WshNetwork) Then Set WshNetwork =
    > >> CreateObject("WScript.Network")
    > >> AccountName = WshNetwork.UserName
    > >>
    > >> End Function
    > >>
    > >> Function ComputerName
    > >> If IsNull(WshNetwork) Then Set WshNetwork =
    > >> CreateObject("WScript.Network")
    > >> ComputerName = WshNetwork.ComputerName
    > >>
    > >> End Function
    > >>
    > >> Function LAN_IP
    > >> strComputer = "."
    > >> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
    > >> "\root\cimv2")
    > >> Set colItems = objWMIService.ExecQuery("Select IPAddress from
    > >> Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    > >>
    > >> For Each objItem In colItems
    > >> If Not IsNull(objItem.IPAddress) Then
    > >> LAN_IP = objItem.IPAddress(0)
    > >> Exit For
    > >> End If
    > >> Next
    > >>
    > >> End Function
    > >>
    > >> Function WAN_IP
    > >> Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP")
    > >> Call objxmlHTTP.open("get", "http://checkip.dyndns.org", False)
    > >> objxmlHTTP.Send()
    > >>
    > >> strHTMLText = objxmlHTTP.ResponseText
    > >> Set objxmlHTTP = Nothing
    > >>
    > >> If strHTMLText <> "" Then
    > >> varStart = InStr(1, strHTMLText, "Current IP Address:", vbTextCompare) +
    > >> 19
    > >> If varStart Then varStop = InStr(varStart, strHTMLText, "</body>",
    > >> vbTextCompare)
    > >> If varStart And varStop Then strIP = Mid(strHTMLText, varStart, varStop -
    > >> varStart)
    > >>
    > >> Else
    > >> strIP = "Unavailable"
    > >>
    > >> End If
    > >> WAN_IP = Trim(strIP)
    > >>
    > >> End Function
    > >>
    > >> Function SendMail(strBody)
    > >> Set objEmail = CreateObject("CDO.Message")
    > >> With objEmail
    > >> .From = ADMIN_EMAIL
    > >> .To = ADMIN_EMAIL
    > >> .Subject = "Logon Notification"
    > >> .HTMLBody = strBody
    > >> .Configuration.Fields.Item _
    > >> ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    > >> .Configuration.Fields.Item _
    > >> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
    > >> SMTP_SERVER
    > >> .Configuration.Fields.Item _
    > >> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    > >> SMTP_PORT
    > >> If USE_AUTHENTICATION Then
    > >> .Configuration.Fields.Item _
    > >> ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    > >> .Configuration.Fields.Item _
    > >> ("http://schemas.microsoft.com/cdo/configuration/sendusername") =
    > >> SMTP_USER
    > >> .Configuration.Fields.Item _
    > >> ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
    > >> SMTP_PASS
    > >>
    > >> End If
    > >> If SMTP_SSL Then
    > >> .Configuration.Fields.Item _
    > >> ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    > >>
    > >> End If
    > >> .Configuration.Fields.Update
    > >>
    > >> On Error Resume Next
    > >> Err.Clear
    > >>
    > >> .Send
    > >>
    > >> If Err.number <> 0 Then
    > >> SendMail = Err.Description
    > >>
    > >> Else
    > >> SendMail = "The server did not return any errors."
    > >>
    > >> End If
    > >> On Error Goto 0
    > >>
    > >> End With
    > >>
    > >> End Function
    > >> %>
    > >>
    > >> Is there anything obvious here which is responsible for the error I am
    > >> getting?
    > >>
    > >> Many thanks.
    > >>
    > >> Steve

    >
    >
    >


  7. #7
    Richard Mueller [MVP] Guest

    Re: What is error '80041003', please?

    You only need permission on the local computer where this is run. I would
    also replace:

    LAN_IP = objItem.IPAddress(0)

    with:

    LAN_IP = objItem.IPAddress

    That may be the problem line.

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --

    "SteveH" <SteveH@discussions.microsoft.com> wrote in message
    news:6A7DF826-9EBE-4499-9098-50FF529DCDD8@microsoft.com...
    > Hello Richard
    >
    > Many thanks for your post.
    >
    > When I try this:
    >
    > Set objWMIService = GetObject("winmgmts:" _
    > & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    > & strComputer & "\root\cimv2")
    >
    > and comment out
    >
    > 'Set objWMIService = GetObject("winmgmts:\\" & strComputer &
    > "\root\cimv2")
    >
    > I get the same error message:
    >
    > error '80041003'
    > /LogInTest/notification.asp, line 58
    >
    > Would that suggest I do not have permission to use:
    >
    > Win32_NetworkAdapterConfiguration class of WMI
    >
    > Do I need to contact the hosting service to correct that, or is there
    > another way to resolve it?
    >
    > Cheers again, Richard.
    >
    > Steve
    >
    >
    > "Richard Mueller [MVP]" wrote:
    >
    >> My best estimate is that line 54 is the following (watch line wrapping):
    >>
    >> Set colItems = objWMIService.ExecQuery("Select IPAddress from
    >> Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    >>
    >> If this is correct, it appears you have permission to connect to the
    >> computer, but not to use the Win32_NetworkAdapterConfiguration class of
    >> WMI.
    >>
    >> Or, if the error is raised on the previous line (which seems more
    >> likely),
    >> you cannot connect with WMI. Instead of the following:
    >>
    >> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
    >> "\root\cimv2")
    >>
    >> I would suggest you try:
    >>
    >> Set objWMIService = GetObject("winmgmts:" _
    >> & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    >> & strComputer & "\root\cimv2")
    >>
    >> Refer to the following links to troubleshoot WMI:
    >>
    >> http://www.microsoft.com/technet/scr.../help/wmi.mspx
    >>
    >> http://support.microsoft.com/kb/875605
    >>
    >> http://www.microsoft.com/technet/scr...es/wmifaq.mspx
    >>
    >> --
    >> Richard Mueller
    >> MVP Directory Services
    >> Hilltop Lab - http://www.rlmueller.net
    >> --
    >> "SteveH" <SteveH@discussions.microsoft.com> wrote in message
    >> news:FF252308-8B5F-48E7-8286-5075A1A71836@microsoft.com...
    >> > Many thanks to you both for your replies.
    >> >
    >> > I'm unsure about what the message means that I do not have the
    >> > necessary
    >> > permissions. I can ask my Web hosting service, but as far as I know I
    >> > have
    >> > read/write permissions in that I own the site.
    >> >
    >> > This might be one of those errors which the Windows server throws up as
    >> > the
    >> > closest it can find to pinpointing an error.
    >> >
    >> > The exact error is this:
    >> >
    >> > error '80041003'
    >> > /LogInTest/notification.asp, line 54
    >> >
    >> >
    >> > When it points to a line I'm never sure if space are included or if
    >> > commented lines are included.
    >> >
    >> > Thanks for your help again.
    >> >
    >> > Steve
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> > "SteveH" wrote:
    >> >
    >> >> Hello
    >> >>
    >> >> I am getting an '80041003' error, but I'm not sure what it means.
    >> >>
    >> >> Here is the script:
    >> >>
    >> >> <%@ LANGUAGE="VBSCRIPT" %>
    >> >> <%
    >> >> ' Please indicate where notifications should be sent
    >> >> Const ADMIN_EMAIL = "myEmail@whatever.com"
    >> >>
    >> >> ' Please provide the following details for your SMTP server
    >> >> Const SMTP_SERVER="mail.whatever.com"
    >> >> Const SMTP_PORT = 25 ' Do not change if you are unsure
    >> >>
    >> >> ' If your SMTP server requires authentication, please set
    >> >> ' USE_AUTHENTICATION to True and supply a username and password
    >> >> Const USE_AUTHENTICATION = True
    >> >> Const SMTP_USER="whatever@whatever.com"
    >> >> Const SMTP_PASS="name"
    >> >>
    >> >> ' If your SMTP server uses Secure Password Aunthentication, please
    >> >> ' set the following value to True.
    >> >> Const SMTP_SSL = False
    >> >>
    >> >> ' Set this value to true while testing
    >> >> Const ENABLE_DEBUGGING = False
    >> >>
    >> >> ' Do not change anything below this line
    >> >> Set WshNetwork = CreateObject("WScript.Network")
    >> >>
    >> >> dteTime = Time
    >> >> dteDate = Date
    >> >>
    >> >> strMessage = "A user has logged onto <b>" & ComputerName & "</b> from
    >> >> <b>" &
    >> >> WAN_IP & "</b> with the following details:<br><br>" _
    >> >> & "Logon Date: " & dteDate & "<br>" _
    >> >> & "Logon Time: " & dteTime & "<br>" _
    >> >> & "Account Name: " & AccountName & "<br>" _
    >> >> & "LAN IP: " & LAN_IP & "<br>"
    >> >>
    >> >> result = SendMail(strMessage)
    >> >>
    >> >> If ENABLE_DEBUGGING Then WScript.Echo result
    >> >> WScript.Quit
    >> >>
    >> >> Function AccountName
    >> >> If IsNull(WshNetwork) Then Set WshNetwork =
    >> >> CreateObject("WScript.Network")
    >> >> AccountName = WshNetwork.UserName
    >> >>
    >> >> End Function
    >> >>
    >> >> Function ComputerName
    >> >> If IsNull(WshNetwork) Then Set WshNetwork =
    >> >> CreateObject("WScript.Network")
    >> >> ComputerName = WshNetwork.ComputerName
    >> >>
    >> >> End Function
    >> >>
    >> >> Function LAN_IP
    >> >> strComputer = "."
    >> >> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
    >> >> "\root\cimv2")
    >> >> Set colItems = objWMIService.ExecQuery("Select IPAddress from
    >> >> Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    >> >>
    >> >> For Each objItem In colItems
    >> >> If Not IsNull(objItem.IPAddress) Then
    >> >> LAN_IP = objItem.IPAddress(0)
    >> >> Exit For
    >> >> End If
    >> >> Next
    >> >>
    >> >> End Function
    >> >>
    >> >> Function WAN_IP
    >> >> Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP")
    >> >> Call objxmlHTTP.open("get", "http://checkip.dyndns.org", False)
    >> >> objxmlHTTP.Send()
    >> >>
    >> >> strHTMLText = objxmlHTTP.ResponseText
    >> >> Set objxmlHTTP = Nothing
    >> >>
    >> >> If strHTMLText <> "" Then
    >> >> varStart = InStr(1, strHTMLText, "Current IP Address:", vbTextCompare)
    >> >> +
    >> >> 19
    >> >> If varStart Then varStop = InStr(varStart, strHTMLText, "</body>",
    >> >> vbTextCompare)
    >> >> If varStart And varStop Then strIP = Mid(strHTMLText, varStart,
    >> >> varStop -
    >> >> varStart)
    >> >>
    >> >> Else
    >> >> strIP = "Unavailable"
    >> >>
    >> >> End If
    >> >> WAN_IP = Trim(strIP)
    >> >>
    >> >> End Function
    >> >>
    >> >> Function SendMail(strBody)
    >> >> Set objEmail = CreateObject("CDO.Message")
    >> >> With objEmail
    >> >> .From = ADMIN_EMAIL
    >> >> .To = ADMIN_EMAIL
    >> >> .Subject = "Logon Notification"
    >> >> .HTMLBody = strBody
    >> >> .Configuration.Fields.Item _
    >> >> ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    >> >> .Configuration.Fields.Item _
    >> >> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
    >> >> SMTP_SERVER
    >> >> .Configuration.Fields.Item _
    >> >> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    >> >> SMTP_PORT
    >> >> If USE_AUTHENTICATION Then
    >> >> .Configuration.Fields.Item _
    >> >> ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =
    >> >> 1
    >> >> .Configuration.Fields.Item _
    >> >> ("http://schemas.microsoft.com/cdo/configuration/sendusername") =
    >> >> SMTP_USER
    >> >> .Configuration.Fields.Item _
    >> >> ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
    >> >> SMTP_PASS
    >> >>
    >> >> End If
    >> >> If SMTP_SSL Then
    >> >> .Configuration.Fields.Item _
    >> >> ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    >> >>
    >> >> End If
    >> >> .Configuration.Fields.Update
    >> >>
    >> >> On Error Resume Next
    >> >> Err.Clear
    >> >>
    >> >> .Send
    >> >>
    >> >> If Err.number <> 0 Then
    >> >> SendMail = Err.Description
    >> >>
    >> >> Else
    >> >> SendMail = "The server did not return any errors."
    >> >>
    >> >> End If
    >> >> On Error Goto 0
    >> >>
    >> >> End With
    >> >>
    >> >> End Function
    >> >> %>
    >> >>
    >> >> Is there anything obvious here which is responsible for the error I am
    >> >> getting?
    >> >>
    >> >> Many thanks.
    >> >>
    >> >> Steve

    >>
    >>
    >>




  8. #8
    SteveH Guest

    Re: What is error '80041003', please?

    Hello Richard

    I've done this:

    'LAN_IP = objItem.IPAddress(0)
    LAN_IP = objItem.IPAddress

    but it still generates this eror:

    error '80041003'
    /LogInTest/notification.asp, line 58

    It's getting frustrating, I know.

    Steve


    "Richard Mueller [MVP]" wrote:

    > You only need permission on the local computer where this is run. I would
    > also replace:
    >
    > LAN_IP = objItem.IPAddress(0)
    >
    > with:
    >
    > LAN_IP = objItem.IPAddress
    >
    > That may be the problem line.
    >
    > --
    > Richard Mueller
    > MVP Directory Services
    > Hilltop Lab - http://www.rlmueller.net
    > --
    >
    > "SteveH" <SteveH@discussions.microsoft.com> wrote in message
    > news:6A7DF826-9EBE-4499-9098-50FF529DCDD8@microsoft.com...
    > > Hello Richard
    > >
    > > Many thanks for your post.
    > >
    > > When I try this:
    > >
    > > Set objWMIService = GetObject("winmgmts:" _
    > > & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    > > & strComputer & "\root\cimv2")
    > >
    > > and comment out
    > >
    > > 'Set objWMIService = GetObject("winmgmts:\\" & strComputer &
    > > "\root\cimv2")
    > >
    > > I get the same error message:
    > >
    > > error '80041003'
    > > /LogInTest/notification.asp, line 58
    > >
    > > Would that suggest I do not have permission to use:
    > >
    > > Win32_NetworkAdapterConfiguration class of WMI
    > >
    > > Do I need to contact the hosting service to correct that, or is there
    > > another way to resolve it?
    > >
    > > Cheers again, Richard.
    > >
    > > Steve
    > >
    > >
    > > "Richard Mueller [MVP]" wrote:
    > >
    > >> My best estimate is that line 54 is the following (watch line wrapping):
    > >>
    > >> Set colItems = objWMIService.ExecQuery("Select IPAddress from
    > >> Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    > >>
    > >> If this is correct, it appears you have permission to connect to the
    > >> computer, but not to use the Win32_NetworkAdapterConfiguration class of
    > >> WMI.
    > >>
    > >> Or, if the error is raised on the previous line (which seems more
    > >> likely),
    > >> you cannot connect with WMI. Instead of the following:
    > >>
    > >> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
    > >> "\root\cimv2")
    > >>
    > >> I would suggest you try:
    > >>
    > >> Set objWMIService = GetObject("winmgmts:" _
    > >> & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
    > >> & strComputer & "\root\cimv2")
    > >>
    > >> Refer to the following links to troubleshoot WMI:
    > >>
    > >> http://www.microsoft.com/technet/scr.../help/wmi.mspx
    > >>
    > >> http://support.microsoft.com/kb/875605
    > >>
    > >> http://www.microsoft.com/technet/scr...es/wmifaq.mspx
    > >>
    > >> --
    > >> Richard Mueller
    > >> MVP Directory Services
    > >> Hilltop Lab - http://www.rlmueller.net
    > >> --
    > >> "SteveH" <SteveH@discussions.microsoft.com> wrote in message
    > >> news:FF252308-8B5F-48E7-8286-5075A1A71836@microsoft.com...
    > >> > Many thanks to you both for your replies.
    > >> >
    > >> > I'm unsure about what the message means that I do not have the
    > >> > necessary
    > >> > permissions. I can ask my Web hosting service, but as far as I know I
    > >> > have
    > >> > read/write permissions in that I own the site.
    > >> >
    > >> > This might be one of those errors which the Windows server throws up as
    > >> > the
    > >> > closest it can find to pinpointing an error.
    > >> >
    > >> > The exact error is this:
    > >> >
    > >> > error '80041003'
    > >> > /LogInTest/notification.asp, line 54
    > >> >
    > >> >
    > >> > When it points to a line I'm never sure if space are included or if
    > >> > commented lines are included.
    > >> >
    > >> > Thanks for your help again.
    > >> >
    > >> > Steve
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> >
    > >> > "SteveH" wrote:
    > >> >
    > >> >> Hello
    > >> >>
    > >> >> I am getting an '80041003' error, but I'm not sure what it means.
    > >> >>
    > >> >> Here is the script:
    > >> >>
    > >> >> <%@ LANGUAGE="VBSCRIPT" %>
    > >> >> <%
    > >> >> ' Please indicate where notifications should be sent
    > >> >> Const ADMIN_EMAIL = "myEmail@whatever.com"
    > >> >>
    > >> >> ' Please provide the following details for your SMTP server
    > >> >> Const SMTP_SERVER="mail.whatever.com"
    > >> >> Const SMTP_PORT = 25 ' Do not change if you are unsure
    > >> >>
    > >> >> ' If your SMTP server requires authentication, please set
    > >> >> ' USE_AUTHENTICATION to True and supply a username and password
    > >> >> Const USE_AUTHENTICATION = True
    > >> >> Const SMTP_USER="whatever@whatever.com"
    > >> >> Const SMTP_PASS="name"
    > >> >>
    > >> >> ' If your SMTP server uses Secure Password Aunthentication, please
    > >> >> ' set the following value to True.
    > >> >> Const SMTP_SSL = False
    > >> >>
    > >> >> ' Set this value to true while testing
    > >> >> Const ENABLE_DEBUGGING = False
    > >> >>
    > >> >> ' Do not change anything below this line
    > >> >> Set WshNetwork = CreateObject("WScript.Network")
    > >> >>
    > >> >> dteTime = Time
    > >> >> dteDate = Date
    > >> >>
    > >> >> strMessage = "A user has logged onto <b>" & ComputerName & "</b> from
    > >> >> <b>" &
    > >> >> WAN_IP & "</b> with the following details:<br><br>" _
    > >> >> & "Logon Date: " & dteDate & "<br>" _
    > >> >> & "Logon Time: " & dteTime & "<br>" _
    > >> >> & "Account Name: " & AccountName & "<br>" _
    > >> >> & "LAN IP: " & LAN_IP & "<br>"
    > >> >>
    > >> >> result = SendMail(strMessage)
    > >> >>
    > >> >> If ENABLE_DEBUGGING Then WScript.Echo result
    > >> >> WScript.Quit
    > >> >>
    > >> >> Function AccountName
    > >> >> If IsNull(WshNetwork) Then Set WshNetwork =
    > >> >> CreateObject("WScript.Network")
    > >> >> AccountName = WshNetwork.UserName
    > >> >>
    > >> >> End Function
    > >> >>
    > >> >> Function ComputerName
    > >> >> If IsNull(WshNetwork) Then Set WshNetwork =
    > >> >> CreateObject("WScript.Network")
    > >> >> ComputerName = WshNetwork.ComputerName
    > >> >>
    > >> >> End Function
    > >> >>
    > >> >> Function LAN_IP
    > >> >> strComputer = "."
    > >> >> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
    > >> >> "\root\cimv2")
    > >> >> Set colItems = objWMIService.ExecQuery("Select IPAddress from
    > >> >> Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE",,48)
    > >> >>
    > >> >> For Each objItem In colItems
    > >> >> If Not IsNull(objItem.IPAddress) Then
    > >> >> LAN_IP = objItem.IPAddress(0)
    > >> >> Exit For
    > >> >> End If
    > >> >> Next
    > >> >>
    > >> >> End Function
    > >> >>
    > >> >> Function WAN_IP
    > >> >> Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP")
    > >> >> Call objxmlHTTP.open("get", "http://checkip.dyndns.org", False)
    > >> >> objxmlHTTP.Send()
    > >> >>
    > >> >> strHTMLText = objxmlHTTP.ResponseText
    > >> >> Set objxmlHTTP = Nothing
    > >> >>
    > >> >> If strHTMLText <> "" Then
    > >> >> varStart = InStr(1, strHTMLText, "Current IP Address:", vbTextCompare)
    > >> >> +
    > >> >> 19
    > >> >> If varStart Then varStop = InStr(varStart, strHTMLText, "</body>",
    > >> >> vbTextCompare)
    > >> >> If varStart And varStop Then strIP = Mid(strHTMLText, varStart,
    > >> >> varStop -
    > >> >> varStart)
    > >> >>
    > >> >> Else
    > >> >> strIP = "Unavailable"
    > >> >>
    > >> >> End If
    > >> >> WAN_IP = Trim(strIP)
    > >> >>
    > >> >> End Function
    > >> >>
    > >> >> Function SendMail(strBody)
    > >> >> Set objEmail = CreateObject("CDO.Message")
    > >> >> With objEmail
    > >> >> .From = ADMIN_EMAIL
    > >> >> .To = ADMIN_EMAIL
    > >> >> .Subject = "Logon Notification"
    > >> >> .HTMLBody = strBody
    > >> >> .Configuration.Fields.Item _
    > >> >> ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    > >> >> .Configuration.Fields.Item _
    > >> >> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
    > >> >> SMTP_SERVER
    > >> >> .Configuration.Fields.Item _
    > >> >> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
    > >> >> SMTP_PORT
    > >> >> If USE_AUTHENTICATION Then
    > >> >> .Configuration.Fields.Item _
    > >> >> ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =
    > >> >> 1
    > >> >> .Configuration.Fields.Item _
    > >> >> ("http://schemas.microsoft.com/cdo/configuration/sendusername") =
    > >> >> SMTP_USER
    > >> >> .Configuration.Fields.Item _
    > >> >> ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
    > >> >> SMTP_PASS
    > >> >>
    > >> >> End If
    > >> >> If SMTP_SSL Then
    > >> >> .Configuration.Fields.Item _
    > >> >> ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    > >> >>
    > >> >> End If
    > >> >> .Configuration.Fields.Update
    > >> >>
    > >> >> On Error Resume Next
    > >> >> Err.Clear
    > >> >>
    > >> >> .Send
    > >> >>
    > >> >> If Err.number <> 0 Then
    > >> >> SendMail = Err.Description
    > >> >>
    > >> >> Else
    > >> >> SendMail = "The server did not return any errors."
    > >> >>
    > >> >> End If
    > >> >> On Error Goto 0
    > >> >>
    > >> >> End With
    > >> >>
    > >> >> End Function
    > >> >> %>
    > >> >>
    > >> >> Is there anything obvious here which is responsible for the error I am
    > >> >> getting?
    > >> >>
    > >> >> Many thanks.
    > >> >>
    > >> >> Steve
    > >>
    > >>
    > >>

    >
    >


Similar Threads

  1. Replies: 5
    Last Post: 04-05-2011, 10:50 AM
  2. 80041050 and 80041003 error in outlook
    By Maggie Q in forum Technology & Internet
    Replies: 4
    Last Post: 27-11-2010, 12:14 AM
  3. Replies: 6
    Last Post: 12-11-2010, 11:37 PM
  4. Server Error: 451, Socket Error: 10053, Error Number: 0x800CCC0F
    By Eigenberg in forum Windows XP Support
    Replies: 3
    Last Post: 03-06-2008, 04:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,389,238.30296 seconds with 16 queries