Automatic location switching - based on IP 
Use this IdeaSpace to post ideas about the Notes Client.

: 36
: 36
: 0
: location document, location, passthru
: Marcel Damseaux198 09 Mar 2011
: / Email
We use an Office location and an Internet location (which uses passthru servers in the DMZ with encrypted Notes ports), with different connection documents, so our users don't need to start/use a special VPN just to get to their mail.
That means I have to switch to the Office location in the morning, and to the Internet location when I take my computer home every day.
What I propose is that the locations can be linked to an IP address or subnet, so my client would switch/start automatically in the location document I have specified for that IP.
That way our users in Notes would have same experience than the Oulook users we are migrating, and not to worry about those location documents anymore.
This would be very similar to Sametime "Geographic locations", it doesn't seem to be "rocket science"; in fact I have implemented it on a very rudimentary way with Lotusscript in minutes (launched at client startup via StartupDB=) and it works (but I need a native thing!).
- Stores location-ranges associations in notes.ini variable, like
$IPLocation=193.180.188.*,Internet;,Internet;192.168.1.*,Internet;10.2.42.*,Office (Network)
Sub LocationSwitcher
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
iplocationarray=Split(session.GetEnvironmentString("IPLocation", False),";")
' Search the location to switch to
Forall iploc In iplocationarray
If Strleft(iploc,",") = myip Then
locationfound = Strright(iploc,",")
End If
End Forall
If locationfound<>"" Then
Print "Setting location according to range "+myip+": "+locationfound
On Error Resume Next
Call workspace.SetCurrentLocation(locationfound)
On Error Goto 0
' pending - validate the location - if it doesn't exist present list  Call workspace.SetCurrentLocation("Internet") is valid!
Call workspace.SetCurrentLocation("")
' Store the location chosen for the future
location=Strleft(session.GetEnvironmentString("Location", True),",")
If iplocationarray(0)="" Then
Call session.SetEnvironmentVar("IPLocation", myIP+","+location,False)
Call session.SetEnvironmentVar("IPLocation", myIP+","+location+";"+session.GetEnvironmentString("IPLocation", False),False) ' notice the new one is added at the begining so if exceeded string older are discarded
End If
End If
End Sub
Function CurrentRange() As String
' This way also gets VPN address
Set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery ("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
Print "Getting IPs", Now
Forall IPConfig In IPConfigSet
If Not Isnull(IPConfig.IPAddress) Then 
For i=Lbound(IPConfig.IPAddress) To Ubound(IPConfig.IPAddress)
If IPConfig.IPAddress(i) <>"" Then
CurrentRange=Strleftback(IPConfig.IPAddress(i),".")+".*" ' return only one
Exit Function
End If
End If
End Forall
End Function

1) David Hablewitz15116 (11 Mar 2011)
Clever. I know you can have multiple connection docs and Notes will try each until it finds a path and you can specify multiple IPs in one connection even. I would have to test it out again to be sure, but I don't think you need to switch locations at all to achieve your goal so long as you don't need a different location for the other settings, like mail file location. (For laptop users I set them to always work locally, even when they are in the office.)
2) Marcel Damseaux198 (11 Mar 2011)
Believe me you do need locations in our situation, we have 40.000 users and Office and Internet locations since 1996 and lots of Notes admins and consultants are and have been in our environment and nobody got a better idea.
There is also a performance issue, you do not want Notes to try connections to servers it will not be able to reach, that will slow down the startup of the client (for the #%#$% ECL refresh - which could be done on the background later, that should be another good idea actually). If the client already knows by its IPs whether to use passthru or direct IP/DNS it would be connecting right away at startup thus starting the client faster.


Welcome to IdeaJam

You can run IdeaJam™ in your company. It's easy to install, setup and customize. Your employees, partners and customers will immediately see results.

Use IdeaJam to:

  • Collect ideas from employees
  • Solicit feedback and suggestions from employees and customers
  • Run innovation contests and competitions
  • Validate concepts
  • Use the power of "crowd-sourcing" to rank ideas and allow the best ideas to rise to the top

IdeaJam™ works with:

  • IBM Connections
  • IBM Lotus Quickr
  • Blogs and Wikis
  • Websphere Portal
  • Microsoft Sharepoint
  • and other applications.

IdeaJam has an extensive set of widgets and API's that allow you to extend and integrate IdeaJam™ with other applications.

Learn more about IdeaJam >>

IdeaJam developed by

Elguji Software Logo