< ^ > addrbook-updates.bat
Generated on Wed Jan 24 18:57:12 Eastern Standard Time 2007 from addrbook-updates.bat
@echo off
title ADDRBOOK-UPDATES - Perform Addressbook maintenance
goto begin
Author : Bob Jonkman <bjonkman@sobac.com>
# Copyright 2008 Bob Jonkman and/or SOBAC Microcomputer Services
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
Date : 28 October 2004
Modified : 3 NOvember 2006 - Removed CSIS
- Added Managers
Note : Make sure the workstation's Regional Settings for Short Date
format can be used for folder names (ie. no slashes)
:begin
set APIpath=\\COTGW500\MAIL\COTPRI\WPGATE\GWAPI
echo Get User List from API gateway...
call get-users.bat
echo Getting the name frequency statistics...
call name-frequencies.bat
echo Create Mailbox List
call mailboxlist.bat
rem echo Make LOCation distribution lists from GW addressbook user records
rem MAKELOC.BAT
echo Make DDSU distribution lists from GW addresbook user records...
call makeddsu.bat
rem CSIS is no longer required
goto pastcsis
echo Make CSIS entries from LDAP...
call makecsis
:pastcsis
echo Create "COT Managers" distribution list
call managers.bat
rem To be continued...
echo Press any key to finish...
pause
:end
rem EOF: ADDRBOOK-UPDATES.BAT
< ^ > get-users.bat
Generated on Wed Jan 24 18:57:12 Eastern Standard Time 2007 from get-users.bat
@echo off
title GET-USERS - Retrieve users list from GW API Gateway
goto begin
Program : GET-USERS.BAT
Purpose : Retrieve users list from GW API Gateway
Note : Make sure the workstation's Regional Settings for Short Date
format can be used for folder names (ie. no slashes)
:begin
set APIpath=\\COTGW500\MAIL\COTPRI\WPGATE\GWAPI
echo Cleaning the API_OUT folder...
rem (this is dangerous, since it may remove files that don't belong to the ADDRBOOK-UPDATE process)
for %%i in (%APIpath%\API_OUT\*.* ) do del %%i
echo Requesting current user list from API gateway...
copy getdirectory.api %APIpath%\API_IN
echo Making destination folder...
if not exist %date%\nul md %date%
echo Deleting any existing API files in %date%...
for %%i in (%date%\*.*) do del %%i
echo Retrieving user list from API gateway...
:copyAPI
move %APIpath%\API_OUT\*.api %date%\users.api 2> nul
if errorlevel == 1 goto copyAPI
echo Creating the User Lists from the API file...
cd %date%
..\gwconv users.api USERS.CSV > nul
cd ..
if exist users.csv del users.csv
echo Copying USERS.CSV to the Addressbook folder...
copy %date%\users.csv .\
rem EOF: GET-USERS.BAT
< ^ > mailboxlist.bat
Generated on Wed Jan 24 18:57:12 Eastern Standard Time 2007 from mailboxlist.bat
@echo off
title MAILBOXLIST.BAT - Create a list all non-generic mailboxes
echo Creating mailboxlist.csv
gawk -f mailboxlist.awk -f library.awk users.csv > mailboxlist.csv
echo Generating mailboxlist.html
gawk -f csv2html.awk -f library.awk -v "TITLE=GroupWise Mailboxes" -v LINK=1 mailboxlist.csv > mailboxlist.html
echo Copying to Web Server
copy mailboxlist.csv \\cotgw506\sys\apache2\htdocs\stats\
copy mailboxlist.html \\cotgw506\sys\apache2\htdocs\stats\
rem EOF: MAILBOXLIST.BAT
< ^ > makecsis.bat
Generated on Wed Jan 24 18:57:12 Eastern Standard Time 2007 from makecsis.bat
@echo off
title MAKECSIS - Acquire list of CSIS staff from LDAP, create GW Addressbook entries
goto begin
Program : MAKECSIS.BAT
Purpose : Acquire list of CSIS staff from LDAP, create GW Addressbook entries
Date : 6 July 2005
Author : Bob Jonkman [bjonkman@sobac.com]
:begin
if "%APIpath%" == "" set APIpath=\\COTGW500\MAIL\COTPRI\WPGATE\GWAPI
set folder=%date%-CSD
if not exist %folder% md %folder%
cd %folder%
echo Clearing existing CSIS files...
for %%i in (csis*.*) do del %%i
echo Clearing the API_OUT folder...
rem (this is dangerous, since it may remove files that don't belong to the MAKECSIS process)
for %%i in (%APIpath%\API_OUT\*.* ) do del %%i
rem ####################################################
rem ##### CSIS external PO deletion #####
rem ####################################################
echo Requesting CSIS user list from API gateway...
copy ..\get-csis.api %APIpath%\API_IN
if errorlevel == 0 goto retrieve
pause
:retrieve
echo Retrieving CSIS user list from API gateway...
:copyAPI
move %APIpath%\API_OUT\*.api csis-out.api 2> nul
if errorlevel == 1 goto copyAPI
echo Converting CSIS-OUT.API to CSIS-OUT.CSV...
..\gwconv csis-out.api csis-out.csv csis-group.csv csis-alias.csv csis-x400.csv > nul
echo Creating CSIS deletion list from CSIS-OUT.CSV to CSIS-DEL.API...
gawk -f user2api-del.awk -f library.awk csis-out.csv > csis-del.api
echo Submitting CSIS deletion list to API gateway...
copy csis-del.api %APIpath%\API_IN
if errorlevel == 0 goto acquire
pause
:acquire
rem ####################################################
rem ##### LDAP acquistion of CSIS info goes here #####
rem ####################################################
echo Acquiring CSIS user list from CSIS LDAP server...
rem ldapsearch parameters: -h host; -b basedn for search; -LLL LDIF format without comments or version; (search filter) ; attribute list
ldapsearch -h ex90.csd.example.com -b "o=Childrens Services" -LLL "(objectClass=mailRecipient)" givenname sn title ou postaladdress telephonenumber facsimiletelephonenumber mobile pager mail uid > csis.ldif
echo Converting CSIS user list from LDAP to CSIS.API...
gawk -f csis-ldif2api.awk -f library.awk csis.ldif > csis.api
rem ##### to be updated once LDAP acquisition is working!
rem gawk -f csis-ldap-nab2api.awk ..\csis.nab > csis.api
echo Submitting CSIS API files to gateway
copy csis.api %APIpath%\API_IN
if errorlevel == 0 goto end
pause
:end
cd ..
rem EOF: MAKECSIS.BAT
< ^ > makeddsu.bat
Generated on Wed Jan 24 18:57:12 Eastern Standard Time 2007 from makeddsu.bat
@echo off
goto begin
Program : MAKEDDSU.BAT
Purpose : Create Department/Division/Section/Unit distribution lists from GW addressbook user records
Date : 22 November 2004
Author : Bob Jonkman
Modified: 10 March 2006 - Added Create DDSU Stats Page
13 March 2006 - Added "NOHTML" parameter
:begin
if "%APIpath%" == "" set APIpath=\\COTGW500\MAIL\COTPRI\WPGATE\GWAPI
rem ##### DDSU Distribution List Membership Deletion API file goes here
rem ##### gawk -f ddsu-del.awk users.csv ddsu-del.api
rem ##### copy ddsu-del.api %APIpath%\API_IN
echo Creating DDSU Distribution List API files...
gawk -f ddsu.awk -f library.awk users.csv > ddsu.api
if "%1" == "NOHTML" goto end
echo Create DDSU stats Web page
gawk -f csv2html.awk -f library.awk -v TITLE="Dept/Div/Sec/Unit (DDSU) Distribution Lists Statistics" -v NOEGUIDE=1 ddsustats.csv > ddsustats.html
copy ddsustats.html \\cotgw506\sys\apache2\htdocs\stats
rem ########### echo Submitting DDSU API files to API gateway...
rem ########### copy ddsu.api %APIpath%\API_IN
:end
rem EOF: MAKEDDSU.BAT
< ^ > managers.bat
Generated on Wed Jan 24 18:57:12 Eastern Standard Time 2007 from managers.bat
@echo off
title MANAGERS.BAT - Create distribution list 'COT Managers' from staff with "Managers" in the title
goto begin
Date : 3 November 2006
Author : Bob Jonkman
:begin
echo Get list of managers from mailboxlist.csv
gawk -f searchfield.awk -f library.awk -v SEARCH=[Mm]anager -v FIELDNAME=Title mailboxlist.csv > managers.csv
rem Get first line with headers
rem gawk "FNR == 1 {print}" mailboxlist.csv > managers.csv
rem Append all lines where field9 contains Manager
rem gawk -v FS="," -v IGNORECASE=1 "$9 ~ /[Mm]anager/" mailboxlist.csv >> managers.csv
echo Convert to API file
gawk -f CSV2API-groupmembers.awk -f library.awk -v GROUPDOMAIN=COTPRI -v GROUPPOSTOFFICE=COTADM -v "GROUPOBJECT=COT Managers" managers.csv > managers.api
rem At this time it's necessary to manually submit to GWAPI
rem EOF: MANAGERS.BAT
< ^ > name-frequencies.bat
Generated on Wed Jan 24 18:57:12 Eastern Standard Time 2007 from name-frequencies.bat
@echo off
goto begin
Program: NAME-FREQUENCIES.BAT
Purpose: Make lists of name frequencies from addressbook data
Author: Bob Jonkman <bjonkman@sobac.com>
# Copyright 2008 Bob Jonkman and/or SOBAC Microcomputer Services
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
Date: 24 March 2004
Parameters: %1 - Filename for user list as generated by GWCONV.EXE
%2 - (opt) directory path for output no trailing \
:begin
if "%1"=="/?" goto help
if "%1"=="/h" goto help
if "%1"=="/H" goto help
if "%1"=="-h" goto help
if "%1"=="-H" goto help
if "%1"=="" set input-file="users.csv"
if not "%1"=="" set input-file=%1
if not "%2"=="" set output-path=%2\
echo.
echo Input file is %input-file%
echo Output path is %output-path%
echo.
echo Creating surname list...
gawk -f nameslot.awk -f library.awk %input-file% > %output-path%surnames.csv
echo Creating surname frequency chart...
gawk -f parse-freq.awk -f library.awk -v FIELDNUM=1 %output-path%surnames.csv > %output-path%surname-freq.csv
echo Creating surname-length frequency chart...
gawk -f parse-freq.awk -f library.awk -v FIELDNUM=3 %output-path%surnames.csv > %output-path%surname-length-freq.csv
echo Creating firstname list...
gawk -f fnameslot.awk -f library.awk %input-file% > %output-path%firstnames.csv
echo Creating firstname frequency chart...
gawk -f parse-freq.awk -f library.awk -v FIELDNUM=1 %output-path%firstnames.csv > %output-path%firstname-freq.csv
echo Creating firstname-length frequency chart...
gawk -f parse-freq.awk -f library.awk -v FIELDNUM=3 %output-path%firstnames.csv > %output-path%firstname-length-freq.csv
echo Creating Web pages...
gawk -f csv2html.awk -f library.awk -v TITLE="Name Frequencies" %output-path%surnames.csv %output-path%surname-length-freq.csv %output-path%firstnames.csv %output-path%firstname-length-freq.csv > namefreq.html
copy namefreq.html \\cotgw506\sys\apache2\htdocs\stats\
set output-path=
set input-file=
echo Done!
echo.
goto end
:help
echo.
echo Help for %0
echo.
echo This program creates name frequency lists from a user-list
echo.
echo Usage: %0 [user-list] [output-path]
echo.
echo The file "user-list" is expected to be in the format created by GWCONV.EXE
echo. "users.csv" is used if no parameter is specified.
echo.
echo The optional "output-path" is where the frequency lists will be created.
echo "output-path" should NOT have a trailing '/'
echo.
:end
rem EOF: NAME-FREQUENCIES.BAT
7 files processed.