home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
servprin.zip
/
delprint.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
2001-02-17
|
2KB
|
120 lines
/* Rexxprogram deletes all assigned printers of all users */
/* of the domain */
/* 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 */
/* deletes all assigned printers of all users from the domain */
/* 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:\assigned.txt'
user = 'd:\user.txt'
out = 'd:\result.txt'
rc=Sysfiledelete(out)
rc = Sysfiledelete(user)
/* 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(user,userinfo.p)
end
do until Userid = ENDE
Userid=Linein(log)
Alias = Linein(log)
AliasType = Linein(log)
Localname = Linein(log)
x = Linein(log)
/*
say Userid
say Alias
say SrvName
*/
if Userid = ENDE then exit
myRc = NetDelete(NETLOGONASN, SrvName, UserId, Alias)
if myRc <> '0' then do
say 'Got error from NetDelete() ' myRc
Fehler = myRc || ' ' || Userid
rc=Lineout(out,Fehler)
end
else do
say 'Logon Assignment removed successfully'
rc=Lineout(out,'Logon assignment removed successfully,' || Userid)
say
end
end
exit 0