home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
servprin.zip
/
getprint.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
2001-02-17
|
2KB
|
117 lines
/* Rexxprogram reads all assigned printers off all users */
/* file LSRXUT.DLL should be located in C:\OS2\DLL */
/* file RXUTILS.DLL should be located in C:\OS2\DLL */
/* in C:\IBMLAN\IBMLAN.ini there is a parameter called OTHDOMAIN= */
/* OTHDOMAIN must not contain anything */
/* gets all assigned printers of all users and writes it to the */
/* file "log" */
/* all files are written and read from drive D:\ by default */
/* the administrator must be logged on at the server */
say 'created by Stefan Beck, stefan_beck_xyz@yahoo.com'
call RxFuncAdd 'SysLoadFuncs','REXXUTIL','SysLoadFuncs'
call SysLoadFuncs
call RxFuncAdd 'RxLoadFuncs','RXUTILS','RxLoadFuncs'
call RxLoadFuncs
call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs'
call LoadLsRxutFuncs
NETACCESS = 10
NETALIAS = 20
NETLOGONASN = 52
NETGROUP = 70
NETSHARE = 190
NETUSER = 280
NETUSERGROUPS = 330
NETGROUPUSERS = 340
log = 'd:\zuord.txt'
rc=SysFileDelete(log)
/* get the name of the server */
log1 = 'x'
'net alias >x'
zeile1=linein(log1)
zeile2=linein(log1)
srvname = subword(zeile2,3,10)
/* ENDE SERVERNAME */
myRc = NetEnumerate(NETUSER, 'userInfo', SrvName)
if myRc <> '0' then do
say 'Got error from NetEnumerate() ' myRc
call DropLsRxutFuncs
exit 9
end
if userInfo.0 = 0 then do
say 'No user accounts defined'
call DropLsRxutFuncs
exit 0
end
say 'Number of users defined: ' userInfo.0
do p = 1 to userinfo.0
rc = lineout('d:\user.txt',userinfo.p)
end
do p = 1 to userinfo.0
myRc = NetGetInfo(NETLOGONASN, 'logonAsnInfo', SrvName, userinfo.p)
if myRc <> '0' then do
say 'Got error from NetGetInfo() ' myRc
call DropLsRxutFuncs
exit 9
end
if logonAsnInfo.count = 0 then do
say 'No logon assignments'
call DropLsRxutFuncs
exit 0
end
do i=1 to logonAsnInfo.count
if logonAsnInfo.i.type = 'Printer alias' then
do
rc = lineout(log,userinfo.p)
rc = lineout(log,logonAsnInfo.i.alias)
rc = lineout(log,logonAsnInfo.i.type)
rc = lineout(log,logonAsnInfo.i.device)
rc = lineout(log,' ')
end
end
end
rc = lineout(log,'ENDE')
exit 0