Retrieving IP address and Computer name with a function

hi everybody

i m developing an help desk application and i would like to know if there 's a function that can retrieve the IP address of a PC and its name.

i hope someone can help me

thank you in adavance

Nicola Bertovello

Subject: retrieving IP address and Computer name with a function

For IP Address create a field by name “Remote_Add” and for Computer Name create field by name “Remote_Host”.

See lotus designer help for more CGI variables.

Regards

Rosie

Subject: retrieving IP address and Computer name with a function

Assuming you are talking about Notes, you use WSH and WMI.

Computer name is easy and fast. I copied the code below from our a class in our inventory application, so just assume that the “doc” is the inventory document.

Set m_oWSHNet = CreateObject(“WScript.Network”)

Set m_oWSHShell = createobject(“WScript.shell”)

doc.domainName = m_oWshNet.UserDomain

doc.computername= m_oWshNet.computerName

doc.windowsusername = m_oWshNet.UserName

Now, to get the IP address you can do this (but this is somewhat slow on some machines):

Function getIPAddresses As String

	Dim sComputerName As String

	sComputerName = "."

	

	Dim i As Integer

	Dim IPConfigSet As Variant

	Dim sList As String

	

	Set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//"& sComputerName &"").ExecQuery("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

	

	Forall IPConfig In IPConfigSet

		If Not Isnull(IPConfig.IPAddress) Then 

			For i=Lbound(IPConfig.IPAddress) To Ubound(IPConfig.IPAddress)

				sList = sList & IPConfig.IPAddress(i) & Chr$(10)

			Next

		End If

	End Forall

	getIPAddresses = sList

End Function

You can also do an inventory of MSI registered software using WMI. Search the web, there are tons of examples for VB and these apply to LotusScript as well. Non-MSI registered software can also be obtained, but the user WILL notice that. The above stuff will only slow them a bit when they first open or execute the code you make to capture this information.

Subject: RE: retrieving IP address and Computer name with a function

I know its too late to ask this question. But if you get a chance please help me in that.

I would like to get the External IP Address. Do you have any sample code for that?

If you go to this site it will give the entire details from where you are connecting.

http://www.getip.com/

Please suggest me in this.

Subject: RE: retrieving IP address and Computer name with a function

Hi there

I posted a code snippet here

http://www.openntf.org/Projects/codebin/codebin.nsf/CodeBySubContributor/93B6B3A143845CFE86256EC90044C8E5

This will do what you want, just extends what Victor has posted

HTH

Scott

Subject: RE: retrieving IP address and Computer name with a function

THANK YOU SO MUCH. it works perfectly.you are great and so kind

nicola