home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
servprin.zip
/
addprint.cmd
next >
Wrap
OS/2 REXX Batch file
|
2001-02-17
|
2KB
|
117 lines
/* Rexxprogram to get the printers asigned to each user */
/* 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 */
/* this rexx script recreates the assigned printers from the file "log" */
/* given in the script. Errors happen due to wrong names of printer */
/* aliases (2783) or wrong (2221)or non-existing user */
/* results are written to the file "out" */
/* 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
SAY 'Attention, this script assignes printers to all users'
say 'on the current domain'
Say 'Continue (Y) ? '
Pull WERT
If WERT = Y then
do
NETACCESS = 10
NETALIAS = 20
NETLOGONASN = 52
NETGROUP = 70
NETSHARE = 190
NETUSER = 280
NETUSERGROUPS = 330
NETGROUPUSERS = 340
log = 'd:\assigned.txt'
out = 'd:\result.txt'
rc=Sysfiledelete(out)
/* get the name of the server */
log1 = 'x'
'net alias >x'
zeile1=linein(log1)
zeile2=linein(log1)
srvname = subword(zeile2,3,10)
rc=Sysfiledelete(log1)
/* END SERVERNAME */
/* Read file with assigned printers*/
do until Userid = ENDE
Userid=Linein(log)
Aliasname = Linein(log)
AliasType = Linein(log)
Localname = Linein(log)
x = Linein(log)
/*
say Userid
say Aliasname
say Aliastype
say Localname
*/
if Userid = ENDE then exit
MyRc = NetAdd(NETLOGONASN, srvname, aliasName, LocalName, UserId)
if myRc <> '0' then do
say 'Got error from NetAdd() ' myRc
Fehler = myRc || ' ' || Userid
rc=Lineout(out,Fehler)
call DropLsRxutFuncs
exit 9
end
else do
/* print results to file "out" */
rc=Lineout(out,'Logon assignment added successfully,' || Userid)
end
end
end