1
votes

I have written 9 routines in the last few weeks in Powershell for Domino, they all appear to do what I need except 1!

This is the RegisterNewUser method, which does everything except the Email address. If I setup a user via Domino Administrator, I get everything including the email address ie internal address that is 'bob patz/smallhome'.

If I use my code this uses the registration process but all I end up with is the domain part of the internal email address '@smallhome'.

Does anyone know how to correct this? I don't think powershell uses the @formula language in any form, so I assume i somehow need to find the right column in a document or database and append the fullname in there somehow.

Is there anyone out there who can help in anyway?

regards Mark

<#TOP TIP: THIS MUST RUN UNDER POWERSHELL (X86), ELSE IT WILL NOT WORK!!

This Powershell Function was created in March 2020 by (myself) Mark Baker as 'a' just to see if I can de-mystify some of the Domino Database stucture, after running short bits of code and using Get-Member on some parts of it and looking at online code snippets and reading some of the online info from IBM I have come up with the function below to Create a New Lotus Notes User.

#

Original Code: 31/03/2020 by MBaker

A lot of work testing and diagnosing the different settings and values EVENTUALLY lead me to getting this working, as at 08/04/2020 I just need to work out the settings for setting the correct email address per person.

#

This is how to use this function:

New-DominoUserRegistration "hazell" "C:\Program Files\IBM\Lotus\Notes\Data\ids\people\dhazell.id" "CN=Dom-01/O=Smallhome" "Daniel" "" "swindon" "Work" "comment" "mail\dhazell" " " "password" 176 "dhazell"

Main use of this function is to connect to an IBM Domino Server and Create a New lotus notes user.

>

Function New-DominoUserRegistration {
[cmdletbinding()]
        param (
        [parameter(Position=0,Mandatory=$true,ValueFromPipeline=$True)][string]$lastname,
        [parameter(Position=1,Mandatory=$true,ValueFromPipeline=$True)][string]$Useridfile,
        [parameter(Position=2,Mandatory=$true,ValueFromPipeline=$True)][string]$mailserver,
        [parameter(Position=3,Mandatory=$true,ValueFromPipeline=$True)][string]$firstname,
        [parameter(Position=4,Mandatory=$false,ValueFromPipeline=$True)][string]$middle,
        [parameter(Position=5,Mandatory=$true,ValueFromPipeline=$True)][string]$certpw,
        [parameter(Position=6,Mandatory=$true,ValueFromPipeline=$True)][string]$location,
        [parameter(Position=7,Mandatory=$true,ValueFromPipeline=$True)][string]$comment,
        [parameter(Position=8,Mandatory=$true,ValueFromPipeline=$True)][string]$maildbpath,
        [parameter(Position=9,Mandatory=$true,ValueFromPipeline=$True)][string]$fwddomain,
        [parameter(Position=10,Mandatory=$true,ValueFromPipeline=$True)][string]$userpw,
        [parameter(Position=11,Mandatory=$true,ValueFromPipeline=$True)][int]$usertype,
        [parameter(Position=12,Mandatory=$true,ValueFromPipeline=$True)][string]$ShortName
    )
cls
# Create Lotus Notes Object
$DomSession = New-Object -ComObject Lotus.NotesSession
# Initialize Lotus Notes Object
# "It'll use your open notes session and authentication Details"
$DomSession.Initialize()

# Use Method from Objects returned in variable $domsession one of which is CreateAdministrationProcess which
# takes a Server as input
$adminProcess = $Domsession.CreateRegistration()

$expiration = (Get-Date).adddays(1095)

$adminprocess.certifieridfile="C:\Program Files (x86)\IBM\Lotus\Notes\Data\ids\cert.id"
$adminprocess.Expiration =$expiration
#$adminprocess.RegistrationLog ="C:\program files (x86)\IBM\lotus\notes\data\reglog.nsf"
#[int]$adminProcess.MinPasswordLength=5
$adminprocess.RegistrationServer="Dom-01/smallhome"
$adminprocess.UpdateAddressBook=$true
$adminProcess.GroupList="Test4"
#$adminProcess.CreateMailDb=$true
#[int]$adminProcess.MailQuotaSizeLimit="100"
#[int]$adminProcess.MailQuotaWarningThreshold="90"
$adminProcess.PolicyName="/Registration_Settings"
$adminProcess.ShortName=$ShortName
[int]$adminProcess.MailOwnerAccess=2
$adminProcess.MailACLManager="LocalDomainAdmins"
$adminProcess.MailInternetAddress="$ShortName"+"@smallhome.local"
$adminProcess.MailTemplateName="Mail85.ntf"

$Notesid=$adminprocess.RegisterNewUser($lastname,$Useridfile,$mailserver,$firstname,$middle,$certpw,$location,$comment,$maildbpath,$fwddomain,$userpw,$usertype)

}
New-DominoUserRegistration "archer" "C:\Program Files (x86)\IBM\Lotus\Notes\Data\ids\people\barcher.id" "CN=Dom-01/O=Smallhome" "basil" "" "swindon" "Work" "comment" "mail\barcher" " " "password" 176 "barcher"
[![enter image description here][1]][1]


  [1]: https://i.stack.imgur.com/2Wamq.png
1
Nobody can possibly help unless you show your code.Richard Schwartz
Hi Richard, fair point :-)mark baker
$Notesid=$adminprocess.RegisterNewUser($lastname,$Useridfile,$mailserver,$firstname,$middle,$certpw,$location,$comment,$maildbpath,$fwddomain,$userpw,$usertype) New-DominoUserRegistration "archer" "C:\Program Files (x86)\IBM\Lotus\Notes\Data\ids\people\barcher.id" "CN=Dom-01/O=Smallhome" "basil" "" "swindon" "Work" "comment" "mail\barcher" " " "password" 176 "barcher"mark baker
You are not showing what $adminprocess is, but if it is a NotesRegistration object from the Notes classes, then you would have had to have set the MailInternetAddress property value on that object before you call RegisterNewUser. Being a relative newbie to PowerShell who has never done anything with it for Notes/Domino, I don't have any idea what PowerShell syntax you would use to set the property, but the NotesRegistration class documentation is here: help.hcltechsw.com/dom_designer/9.0.1/appdev/…Richard Schwartz
Ok code added Best regardsmark baker

1 Answers

0
votes

I now have an answer for this, this came from someone else on another board: the line [parameter(Position=9,Mandatory=$true,ValueFromPipeline=$True)][string]$fwddomain,

Needed to have [AllowEmptyString()] inserted before [string]$fwddomain, and the input field was " " and needed to be "". It appears the $fwddomain has an impact on the internal email address name ie: 'bob patz/smallhome'.

I have tested this and it shows up in the people view and also I can now send emails to other users and ones self!

Problem solved. Regards Mark