Article
Introduction
This article demonstrates the GroupWise Administrative Object API using VBScript and how it can be used to export information about GroupWise objects – i.e. domains, post offices, users. While information about GroupWise objects is available in eDirectory and can be exported using other tools and methods, the GroupWise Administrative API presents the GroupWise objects the way they are organized in GroupWise and not how they are represented in eDirectory.
To keep the scripting examples simple and clear the following as been done:
- all scripts are run using cscript.exe from a command window
- all output is written to standard output using wscript.echo. Output can be redirected to file – e.g. cscript /nologo gwscript.vbs > output.csv
- the output format will be comma separated value to allow easy import into other applications such as spreadsheets or databases
- constants are used in place passing command line arguments
- error checking in the scripts has been omitted.
Getting started
The GroupWise Administrative API requires:
- Windows XP or better
- Novell Client32
- GroupWise Client
- An eDirectory connection with sufficient rights to administer GroupWise
- a mapped drive connection to a GroupWise domain and sufficient file trustee rights
In short everything ConsoleOne requires to administer GroupWise, If you are already administering GroupWise chances are your system meets the requirements.
A text editor is also needed. Both notepad and edit are included with Windows. I prefer edit because it shows line and column numbers; cscript displays the line and column number when it encounters problems.
Basic scripts
The first script is as basic as it gets. It creates the GroupWise system object, connects to the domain and outputs some basic information about the system and the API and is intended primarily to test the connection to GroupWise. To use change DomainPath to suit your environment.
listSystemInfo.vbs
Option Explicit
const DomainPath = "k:\dom1"
dim GWSystem
'create the object and connect to the domain
set GWSystem=CreateObject("NovellGroupWareAdmin")
GWSystem.Connect( DomainPath )
'output the system information
wscript.echo GWSystem.Name & "," _
& GWSystem.APIMajorVersion & "," _
& GWSystem.APIMinorVersion & "," _
& GWSystem.LastModifiedBy
It should produce output similar to the following:
c:\gwscripts>cscript /nologo listSystemInfo.vbs MYCOMPANYGW,2,0,(MYCOMPANYTREE) admin.MyCompany
Note: For those not familiar with VBScript, the line continuation character '_' is used to make the scripts more readable.
This next script expands on the first and lists the domains in the system. Again, change the constant DomainPath for your environment.
listDomains.vbs
option explicit
const DomainPath = "k:\dom1"
dim GWSystem
dim GWDomain
'create the object and connect to the domain
set GWSystem=CreateObject("NovellGroupWareAdmin")
GWSystem.Connect( DomainPath )
'iterate through the collection of domains and output some domain properties
for each GWDomain in GWSystem.Domains
wscript.echo GWDomain.Name & "," _
& GWDomain.Description & "," _
& GwDomain.DomainType & "," _
& GwDomain.Path
next
It should produce output similar to the following:
c:\gwscripts>cscript /nologo listDomains.vbs pridom,Primary domain used for administration,2,\\fs01\vol1\gwdomain nyc,New York,1,\\fs02\vol1\gwdomain la,Los Angeles,1\\fs03\vol1\gwdomain
Similarly, this script lists the post offices in the system.
listPostOffices.vbs
option explicit
const DomainPath = "k:\dom1"
dim GWSystem
dim GWPostOffice
'create the object and connect to the domain
set GWSystem=CreateObject("NovellGroupWareAdmin")
GWSystem.Connect( DomainPath )
'iterate through the collection of post offices and output some post office properties
for each GWPostOffice in GWSystem.PostOffices
wscript.echo GWPostOffice.Name & "," _
& GWPostOffice.Description & "," _
& GWPostOffice.Path
next
It should produce output similar to the following:
c:\gwscripts>cscript /nologo listPostOffices.vbs acct,Accounting,\\fs04\vol1\gwacct corp,Corporate,\\fs05\vol1\gwcorp eng,Engineering,\\fs06\vol1\gweng hr,Human Resources,\\fs07\gwhr infosys,Information Systems,\\fs08\gwinfosys
This next script lists all the users in the system.
listUsers.vbs
option explicit
const DomainPath = "k:\dom1"
dim GWSystem
dim GWUser
'create the object and connect to the domain
set GWSystem=CreateObject("NovellGroupWareAdmin")
GWSystem.Connect( DomainPath )
'iterate through the collection of users and output some user properties
for each GWUser in GWSystem.Users
wscript.echo GWUser.Name & "," _
& GWUser.Surname & "," _
& GWUser.GivenName & "," _
& GWUser.Title & "," _
& GWUser.Department & "," _
& GWUser.PhoneNumber & "," _
& GWUser.FaxNumber & "," _
& GWUser.MailboxID 'aka the file identifier
next
It should produce output similar to the following:
c:\gwscripts>cscript /nologo listPostOffices.vbs enate,Nate,Emma,Vice President,Human Resources,555-1028,555-1234,7xb jwalker,Walker,Jay,Senior Engineer,Engineering,555-1010,555-1234,eds planders,Landers,Phil,Programmer,Information Systems,555-1086,555-1234,f93
Similar scripts can be created to list resources, nicknames and distribution lists.
More advanced scripts
Introducing some conditional logic can produce exception exports to better administer a system as in the following examples:
listNonVisibleUsers.vbs
'list all user accounts with visibility set to None.
option explicit
const DomainPath = "k:\dom1"
'define constants as used in the the API documentation
const eadVisPostOffice = 1
const eadVisSystem = 2
const eadVisDomain = 3
const eadVisNone = 4
dim GWSystem
dim GWUser
'create the object and connect to the domain
set GWSystem=CreateObject("NovellGroupWareAdmin")
GWSystem.Connect( DomainPath )
'iterate through the collection of users and output users with visibility set to none
for each GWUser in GWSystem.Users
if GWUser.Visibility = eadVisNone then
wscript.echo GWUser.Name & "," _
& GWUser.Surname & "," _
& GWUser.GivenName & "," _
& GWUser.Title & "," _
& GWUser.Department & "," _
& GWUser.PhoneNumber & "," _
& GWUser.FaxNumber & "," _
& GWUser.MailboxID
end if
next
listExpiredUsers.vbs
'list all accounts where login is disabled the account is expired.
' note: the value returned for accounts without an expiration date is zero
option explicit
const DomainPath = "k:\dom1"
dim GWSystem
dim GWUser
set GWSystem=CreateObject("NovellGroupWareAdmin")
GWSystem.Connect( DomainPath )
'iterate through the collection of users and output users with login disabled or an expiration date greater than zero and less than today
for each GWUser in GWSystem.Users
if GWUser.DisableLogin = True _
or ( GWUser.MailBoxExpDate < now() _
and GWUser.MailBoxExpDate > 0 ) then
wscript.echo GWUser.Name & "," _
& GWUser.Surname & "," _
& GWUser.GivenName & "," _
& GWUser.Title & "," _
& GWUser.Department & "," _
& GWUser.PhoneNumber & "," _
& GWUser.FaxNumber & "," _
& GWUser.MailboxID & "," _
& GWUser.MailBoxExpDate
end if
next
It should produce output similar to the following:
hscope,Scope,Horrace,Benefits Specialist,Human Resources,555-1034,555-1234,1n6,27/05/2 011 3:37:00 PM lprice,Price,Lois,Purchaser,Accounting,555-1034,555-1234,7xb,12:00:00 AM
Summary
The documentation for the GroupWise Administrative Object API can be found at:
http://developer.novell.com/documentation/gwadmin/pdfdoc/gwadmenu/gwadmenu.pdf
It provides a complete reference of the objects, their properties and methods.
I hope the scripts in this article demonstrate the potential of the Administrative Object API to better administer a GroupWise system and provide useful starting point to creating your own set of tools.
Good luck.
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.
Related Articles
User Comments
- Be the first to comment! To leave a comment you need to Login or Register
- 3959 reads


0