tjcarst
Hey THIS is FUN
Registered: 2003-09-08
Posts: 243
Loc: USA
|
Thanks.
I have visited the UDF site and have searched this site extensively. Thus far, I haven't found anything that works for my environment.
Modifying the schema isn't something that I would like to try, either
I can't figure out the INI file, so I was trying it with groups. sealeopard also mentioned an INI file, and wanted to know specifically what I was trying to do. Noting that my INI file wasn't optimized. Not knowing how to optimize it, I am stuck.
Now that I have captured existing printers, I would like to use the INI file exclusively to control the managment of printers. Adding and removing printers using this INI file only, not Windows. When users login, the INI file is checked based upon the computername, and printers are added and removed using the existing INI file.
I have considered modifying the existing script to only READPROFILESTRING and not WRITEPROFILESTRING, but can't figure out the logic on my own. Again, my lack of programming skills are apparent.
If anyone can make suggestions to my existing scripts, it would be wonderful. I now know using group membership isn't the best way, so I'd like to try and figure out the INI file, with assistance.
I have an existing INI file for over 400 pc's. It is created by this code:
code:
;Re-Write at http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=2;t=004308 ;By Kdyer & Lonkero (15th april 2003) ;Re-Write of http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=10;t=000021 ; Ref. http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=006790 ; Ref. http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000221
;********** Prevent logon script on server *********
call @ScriptDir+'\osid.udf'
$os=osid() if $os[2]<>'Workstation' exit 0 endif
;********** Prevent script from running on Medrec pcs *********
if InGroup ("Medrec Group") exit 0 endif
;********** Beginning of printer configuration script *********
;---- Default Printer Configuration ----
;This is to capture the Default Printer and get all network defined printers as well $loc='HKEY_CURRENT_USER\Network\LPT1' $reg='HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion' $dev=$reg+'\Devices' $nprt=split(READVALUE($reg+'\Windows','Device'),',')[0] $sysdrv=SUBSTR('%WINDIR%',1,2) dim $priReg, $x, $i, $rc, $ps ; ---- Set Printsetup.ini file location ----
$ps=('\\mrh-01\prtlog$') $ps=($ps+'\@wksta')
IF 0=EXIST($ps) MD $ps ENDIF
$ps=$ps+'\Printsetup.ini' $i=0 DO IF '\\'=LEFT($x,2) $priReg=$priReg+$x ENDIF $x=ENUMVALUE($dev,$i) $i=$i+1 UNTIL @error IF LEN($priReg) $rc=WRITEPROFILESTRING($ps,'Printers','','') $priReg=split($priReg,'\\') FOR $i=1 to ubound($priReg) $rc=WRITEPROFILESTRING($ps,'Printers',$i,'\\'+$priReg[$i]) NEXT ENDIF SELECT CASE INSTR($nprt,'\\') ;WRITE THE DEFAULT PRINTER TO THE CONFIG $rc=WRITEPROFILESTRING($ps,'Printers','Default',$nprt) USE LPT1: /delete /persistent USE LPT1: $nprt /persistent CASE $nprt='' AND EXIST($ps) ;NO DEFAULT PRINTER, LOAD PRINTERS FROM SAVED INFO FOR EACH $key IN split(readprofilestring($ps,'Printers',''),chr(10)) $nul=addprinterconnection(readprofilestring($ps,'Printers',$key)) NEXT $nprt=READPROFILESTRING($ps,'Printers','Default') $rc=SETDEFAULTPRINTER($nprt) USE LPT1: $nprt /persistent CASE NOT INSTR($nprt,'\\') ;LOCAL PRINTER DEFAULT, SO WE WANT TO REMOVE NETWORK MAPPING USE LPT1: /delete /persistent ENDSELECT
Resulting INI file: [Printers] 1=\\mrh-01\q-mis1 2=\\mrh-01\q-mis2 Default=\\mrh-01\q-mis2
This works to add printers if all are deleted, however, if I delete one, it just updates the INI file. I want it to add it back by checking the INI file. Currently, it updates the computer using the INI file with the previously recorded printers ONLY if there are none.
How do I modify this script to use the INI file EXCLUSIVELY for printer management?
Thanks.
tjcarst [ 13. October 2003, 16:31: Message edited by: tjcarst ]
|