tirsdag den 4. oktober 2011

Lotus Notes Shelling


I hate Lotus Notes - and I love Powershell. Now i have a solution:

I found an old manual on Google explaining how to access Notes via Powershell. Since it was a cashed site it I updated the manual and posted it here, so it may benefit all other Shellers.

My system:
Windows 7
Notes 8.5
Powershell 2.0


Make sure that the path of your notes id file is correct.
Check your notes.ini file : KeyFilename=the direcory containing the id file\yourID.id

[Generate the Domino.dll file]
You need a tlbimp.exe file.
I copied C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\tlbimp.exe to my local machine (C:\Temp) from a CS installation on a different machine. I think any installed version of VS could do.
Run the following commands:
regsvr32 "C:\Program Files\Lotus\Notes\nlsxbe.dll"
C:\Temp\tlbimp.exe "C:\Program Files\Lotus\Notes\domobj.tlb"

then you can see that the the Domino.dll is generated in the same directory:
C:\Temp\Domino.dll

Basic shell:

#[Connect to the DB, Get View and Get the Doc]
#including the Domino.dll
add-pssnapin "C:\Temp\Domino.dll"

#Specifying the Password (the password matching your notes.id file)
$NotesPassword = "PASSWORD"

#Specifying the Server Name
$NotesHost = "SERVER_NAME";

#Specifying the DB Name
$Database = "DB_NAME.nsf";

#Create Session
$Session = New-Object Domino.NotesSession

#Initialize the Session
$Session.Initialize($NotesPassword);

#Get the DB
$db = $Session.GetDatabase($NotesHost, $Database)

The rest is up to you ;-)

Ingen kommentarer:

Send en kommentar