ClientIP Property

ClientIP Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The ClientIP property indicates the TCP/IP address of the messaging client that originally submitted the message. The ClientIP property is read-only.

Applies To

The ClientIP property is a member of the Exchange_MessageTrackingEntry Class.

Instance Path

The ClientIP property appears on instances of the \\COMPUTERNAME\ROOT\MicrosoftExchangeV2:Exchange_MessageTrackingEntry class.

MOF Syntax

[read] string ClientIP;

Qualifiers

This property has no qualifiers.

Selecting Instances Using VBScript

The following example shows how to retrieve a list of Exchange_MessageTrackingEntry instances, and the ClientIP property, using the ExecQuery method.

'===============================================================
' Name:      ShowExchange_MessageTrackingEntry_Query_ClientIP
' Purpose:   Display each Exchange_MessageTrackingEntry found for the
'            specified Exchange server, and show the ClientIP
'            property for each Exchange_MessageTrackingEntry
'            instance. Only log entries created within the
'            number of hours specified are displayed.
' Input:     strComputerName [string] the computer to access
'            intHoursToShow [integer] the number of hours before the
'            present time for which log entries will be shown.
'            intUTCOffset [integer] Local time offset from UTC
' Output:    Displays the KeyID and ClientIP properties
'            for each Exchange_MessageTrackingEntry created
'            within the specified time.
'
'===============================================================
' IMPORTANT: This script may take a very long time to execute when run
'            on a heavily used Exchange server, or when a very long
'            intHoursToShow is given. This script uses the ExecQuery
'            programming style, and gives a lower limit to the
'            TimeLogged property. It is recommended that applications
'            specify lower and upper bounds for the TimeLogged
'            property to improve performance.
'===============================================================
Public Sub ShowExchange_MessageTrackingEntry_Query_ClientIP ( _
  strComputerName, intHoursToShow, intUTCOffset )

Const cWMINameSpace = "root/MicrosoftExchangeV2"
Const cWMIInstance = "Exchange_MessageTrackingEntry"

Dim strWinMgmts              ' Connection string for WMI
Dim objWMIExchange           ' Exchange Namespace WMI object
Dim listExchange_MessageTrackingEntries ' Exchange_MessageTrackingEntry
                             ' collection
Dim objExchange_MessageTrackingEntry ' An Exchange_MessageTrackingEntry
                             ' instance
Dim intRecipientIndex        ' A counter for the recipient and
                             ' recipient status arrays
Dim strWQLQuery              ' A string for the Query
Dim strQueryLanguage         ' A string for the Query Language
Dim dtListFrom               ' Date/Time start for log entry inclusion
Dim strStartDateTime         ' WMI time stamp for log entry inclusion

' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=impersonate),
' on the computer passed to the function in strComputerName, and
' using the CIM namespace for the Exchange_MessageTrackingEntry
' provider.
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//" & _
   strComputerName & "/" & cWMINameSpace
'
' Get an object using the string you just created.
Set objWMIExchange =  GetObject(strWinMgmts)
'
'
' Create a date in the string form expected by WMI.
' For example, 12 November 2001, 4:29:24 = 20011120042924.000000+000
' Time stamps in WMI are compared as strings, and the TimeLogged
' property is always given with zero offset from UTC.
'
' Get the UTC-adjusted log-entry cutoff time.
dtListFrom = DateAdd("h",(intHoursToShow - intUTCOffset),now)
'
' Initialize the time stamp string with the year.
strStartDateTime = year(dtListFrom)
' Add a leading zero for the month, if needed.
if (Month(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the month value to the string.
strStartDateTime = strStartDateTime & Month(dtListFrom)
' Add a leading zero for the day, if needed.
if (Day(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the day value to the string.
strStartDateTime = strStartDateTime & Day(dtListFrom)
' Add a leading zero for the hours, if needed.
if (Hour(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the hours value to the string.
strStartDateTime = strStartDateTime & Hour(dtListFrom)
' Add a leading zero for the minutes, if needed.
if (Minute(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the minutes value to the string.
strStartDateTime = strStartDateTime & Minute(dtListFrom)
' Add a leading zero for the seconds.
if (Second(dtListFrom) < 10) then strStartDateTime = strStartDateTime & "0"
' Add the seconds value to the string, the part for fractional
' seconds, and an empty UTC offset. The empty UTC offset is
' needed to match the offset used by the TimeLogged property.
strStartDateTime = strStartDateTime & Second(dtListFrom) & ".000000+000"
'
' Construct the WQL Query string. Note the double-quotes surrounding
' the previously constructed date string, and that the SELECT clause
' requests only the KeyID and ClientIP properties.
strWQLQuery = "SELECT KeyID, ClientIP " & _
    "FROM Exchange_MessageTrackingEntry " & _
    "WHERE TimeLogged > """ & strStartDateTime & """"

' Display the query string you just constructed.
WScript.echo "The query string to be used: "
WScript.echo "    " & strWQLQuery

' Set the WMI Query Language (WQL) indicator.
strQueryLanguage = "WQL"

' The instances are returned as a list of Exchange_MessageTrackingEntry
' instances in the Exchange namespace.
Set listExchange_MessageTrackingEntries = objWMIExchange.ExecQuery ( _
    strWQLQuery, strQueryLanguage)

' Indicate how many items were returned by the query.
WScript.echo "Number of message tracking log entries returned: " & _
    listExchange_MessageTrackingEntries.Count
'
' Iterate through the list of Exchange_MessageTrackingEntry objects.
For each objExchange_MessageTrackingEntry in _
   listExchange_MessageTrackingEntries
   '
   ' Display the value of the KeyID property.
   WScript.echo "KeyID = " & _
    "[" & TypeName(objExchange_MessageTrackingEntry.KeyID) & "] " & _
     objExchange_MessageTrackingEntry.KeyID
   '
   ' Display the value of the ClientIP property.
   WScript.echo "    ClientIP = [" & _
     TypeName(objExchange_MessageTrackingEntry.ClientIP) & "] " & _
    objExchange_MessageTrackingEntry.ClientIP
   '
   '
   ' Move to the next Exchange_MessageTrackingEntry.
Next
end Sub

VBScript Example

The following example shows how to retrieve a list of Exchange_MessageTrackingEntry instances, and how to retrieve the ClientIP property.

'===============================================================
' Name:      ShowExchange_MessageTrackingEntry_ClientIP
' Purpose:   Display each Exchange_MessageTrackingEntry found for the
'            specified Exchange server, and show the ClientIP
'            property for each Exchange_MessageTrackingEntry
'            instance.
' Input:     strComputerName [string] the computer to access
' Output:    Displays the KeyID of each Exchange_MessageTrackingEntry and
'            the ClientIP properties.
'
'===============================================================
' IMPORTANT: This script may take a very long time to execute when run
'            on a heavily used Exchange server, because the script
'            lists information about all message transfers recorded
'            in the message tracking logs. The GetInstances style
'            of access used in this script causes the WMI provider
'            to enumerate all log entries. To improve the performance
'            of scripts using Exchange_MessageTrackingEntry instances,
'            it is recommended you use WMI ExecQuery, and restrict
'            the results range with the TimeLogged property.
'===============================================================
Public Sub ShowExchange_MessageTrackingEntry_ClientIP ( strComputerName )

Const cWMINameSpace = "root/MicrosoftExchangeV2"
Const cWMIInstance = "Exchange_MessageTrackingEntry"

Dim strWinMgmts              ' Connection string for WMI
Dim objWMIExchange           ' Exchange Namespace WMI object
Dim listExchange_MessageTrackingEntries ' Exchange_MessageTrackingEntry
                             ' collection
Dim objExchange_MessageTrackingEntry ' A single Exchange_MessageTrackingEntry
                             ' instance

' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=impersonate),
' on the computer passed to the function in strComputerName, and
' using the CIM namespace for the Exchange_MessageTrackingEntry provider.
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//" & _
   strComputerName & "/" & cWMINameSpace
'
' Get an object using the string you just created.
Set objWMIExchange =  GetObject(strWinMgmts)
'
' The instances appear as a list of Exchange_MessageTrackingEntry
' instances in the Exchange namespace.
Set listExchange_MessageTrackingEntries = objWMIExchange.InstancesOf(cWMIInstance)
'
' Iterate through the list of Exchange_MessageTrackingEntry objects.
For each objExchange_MessageTrackingEntry in listExchange_MessageTrackingEntries
   '
   ' Display the value of the KeyID property.
   WScript.echo "KeyID = " & _
    "[" & TypeName(objExchange_MessageTrackingEntry.KeyID) & "] " & _
     objExchange_MessageTrackingEntry.KeyID
   '
   ' Display the value of the ClientIP property.
   WScript.echo "    ClientIP = [" & _
     TypeName(objExchange_MessageTrackingEntry.ClientIP) & "] " & _
    objExchange_MessageTrackingEntry.ClientIP
   '
   ' Move to the next Exchange_MessageTrackingEntry.
Next
end Sub

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.