Archive for the ‘howto’ Category

powershell rangers: domino console magick

Monday, April 5th, 2010

the following script is an example of how to run domino console commands via powershell. yes server controller can do this, but sometimes its nice to see how to use the lotus notes com object.

it is dependent on lotus notes finding the correct notes.ini for your environment.

tip: if you’re running the network drive, make sure you place the path to the ini file before c:\windows, c:\windows\system32 and c:\path\to\lotus\notes. this applies to allow applications that use the notes client com object.

# provide default parameters if none are specified (this will fail if you don't have a server called NOTESERVER1

param(
	[string] $server = "NOTESERVER1",
	[string] $cmd = "sh ta"
)

# begin lotus notes magick
$session = New-Object -comobject Lotus.NotesSession
$session.initialize()
$session.Username

$session.SendConsoleCommand( $server, $cmd )