Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

AutoIT & Lotusscript

Posted on 2013-06-18
7
Medium Priority
?
1,533 Views
Last Modified: 2013-11-16
Hi All

I am trying to register a Lotus Notes user from an AutoIt script using the COM object, so far I have achived little success.  The AutoIT script enclosed will go through the registration process and create the users ID file but will not add any entry to the Address book as you would expect.
I have tested the same script using VBScript and this works perfectly well from the command line but I would prefer to only use lotus script and not to shell out from AutoIT.

Please see the code enclosed, any help would be greatly appreciated as I am pulling my hair out at this stage

<AutoIT>

$Session = ObjCreate("Lotus.NotesSession")

if not IsObj($Session) then
    Msgbox(0,"Status","Couldn't attach to Lotus.")
else
    Msgbox(0,"Status","Attached to Lotus.")
endif
$Session.Initialize()

$Reg = $Session.CreateRegistration()
$Reg.RegistrationServer = "serverA"
$Reg.CertifierIDFile = "c:\cert.id"
$Reg.Mailinternetaddress = "Roger.Whooly@company.com"
$Reg.IDType =172
;$Reg.OrgUnit = "Unit"
$Reg.Expiration = 01/01/2099
$Reg.MinPasswordLength = 6
$Reg.RegistrationLog = "log.nsf"
$Reg.CreateMailDb = True
$Reg.IsNorthAmerican = True
$Reg.UpdateAddressBook = True
$Reg.StoreIDInAddressBook = True
$Reg.CreateMailDB = True
$User=$Reg.RegisterNewUser("Whooly", "c:\user2.id", "CN=serverA/O=Unit","Roger","","cert_password","","","mail\rwhooly.nsf","", "user_password",175)


Exit


<VBScript>

Dim FirstName, FamilyName, Email, Expiry, MailDB

If Wscript.Arguments.Count = 2 Then
    FirstName = Wscript.Arguments(0)
      FamilyName = Wscript.Arguments(1)
      Email = Firstname & "." & FamilyName & "@company.com"
      Expiry = DateAdd("yyyy",1,Date)
      MailDB = LCase("mail\" & Left(FirstName,1) & Familyname & ".nsf")
      
Else
      MsgBox("Users full name missing.....Exiting!")
      Wscript.Quit
End If

Set objLN = CreateObject( "Lotus.NotesSession" )
objLN.Initialize()
Set reg = objLN.CreateRegistration
reg.RegistrationServer = "serverA"
reg.CertifierIDFile = "c:\cert.id"
reg.MailInternetAddress = Email
reg.IDType = 172
reg.CreateMailDb = True
reg.UpdateAddressBook = True
reg.Expiration = Expiry
reg.MinPasswordLength = 6
reg.IsNorthAmerican = True
reg.StoreIDInAddressbook = False
reg.RegisterNewUser FamilyName,"c:\user.id","CN=serverA/O=Unit",FirstName, "",      "cert_password", "", "", MailDB, "", "user_password",175

Many thanks for you time.
TomC
0
Comment
Question by:fhios
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 43

Accepted Solution

by:
Steve Knight earned 1500 total points
ID: 39258455
Hmm, use autoit but never tried to create domino user with it.

gut feeling... the 'true' values.... in vbscript it will probably assign string value 1 to those entries.  In autoit .... maybe setting to -1 or something else that it doesn't like.

will check when on pc in bit but would suggest check type required for those values and try "1" instead.

steve
0
 
LVL 11

Expert Comment

by:larsberntrop
ID: 39258518
What I don't see, is how you identify yourself.  By that I mean that the script needs to run as a user with permission to add a new user.
You can check this by adding something like

Print $Session.EffectiveUserName
or
Print ObjLN.EffectiveUserName

You then need to check in the Notes/Domino environment if the name printed has appropiate access. The Administrator Help topic Customizing user registration lists the required permissions:
Access to the certifier ID and its password, if you are not using a certifier enabled for the CA process.
Editor access or Author access with Create Document role and the UserCreator privilege in the Domino Directory. UserCreator role is required regardless of your access level.
Access to the Domino Directory from the computer you work on. Local or remote access to USERREG.NSF.
Create new databases access on the mail server to create user mail files during registration.
Create document access to CERTLOG.NSF on the registration server.
GroupModifier role or at least Editor access to add users to groups.

Please make sure the ID associated with the printed name has these rights.
0
 

Author Closing Comment

by:fhios
ID: 39260013
Many thanks Steve, couldnt see the wood for the trees.

Regards
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Expert Comment

by:Steve Knight
ID: 39260056
So was that it then that worked, the difference between -1 and 1 representations of "true"?

I did start to have a look earlier but hadn't had a chance to try from autoit.

Steve
0
 

Author Comment

by:fhios
ID: 39261653
Yup that was it changed true to 1 and bingo all the values took.  I hadnt thought of changing this value as syntactically it was accepted by Autoit and VBS also used it, again thanks.

Regards
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 39261662
No problem, would you mind then if I asked the mods to amend the grade... don't like "b" grades!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39261899
Steve, I'd never have guessed it could be True...  ;-))
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question