|
|
|||||||
My problem is somewhat similar to JLMartinez's. I too have a script that loads very sluggish. True we've got a lot of "if ingroup" statements. I will put some parts of it here for you to see. Any comment on what it is supposed to do is given with each part of code. I will only put parrts here, most of it is the same. Code: ;Versie : 2.14 ;Datum : 19-09-2008 ;Laatste wijziging : Adobeupdater disabled Clear out lines used no more ;Door : Ed ; if @dos=("4.10") goto 98 else goto normal ;---------------------------------------------- :98 ; run win98.bat call "98.kix" goto end ;---------------------------- :normal ;SETCONSOLE("HIDE") $start="@time" $ver="2.13" $dos="@dos" ;---------------------------- setconsole("hide") SETTIME "\\AS-07" $ASERVER="AS-01" $BSERVER="AS-02" $CSERVER="AS-03" $DSERVER="AS-04" $ESERVER="AS-05" $FSERVER="AS-06" $GSERVER="AS-07" $HSERVER="AS-08" $ISERVER="AS-09" $JSERVER="AS-10" $KSERVER="ATS-01" $LSERVER="ATS-02" ;Adobe Updater switch off --------------------------- Call "Adobe.kix" ;Home Mapping X --------------------------------------- USE x: /d USE x: "\\$ASERVER\Home$\@USERID" ;groups mappings------------------------------- IF INGROUP("U_USER_ADMINIST") USE H: /d USE H: "\\$ASERVER\GROEP\ADMINIST" ENDIF IF INGROUP("U_MAN_ADMINIST") USE H: /d USE H: "\\$ASERVER\GROEP\ADMINIST" ENDIF IF INGROUP("U_USER_APPBEHEER") USE J: /d USE J: "\\$ASERVER\GROEP\APPBEHEER" USE K: /d USE K: "\\$ASERVER\GROEP\ADMINIST" ENDIF IF INGROUP("U_USER_AUTOMAT") USE H: /d USE H: "\\$ASERVER\GROEP\AUTOMAT" USE S: /d USE S: "\\$ASERVER\DEV" ENDIF First part: Comment on version and recent changes, first check is done on OS, wich fires a totally different script. This is done because otherwise some of the mappings could not be made. If you're on an XP machine it skips to :normal, connects X: to your homeshare, and starts making group connections, based on group membership. Where possible multiple mappings for one group are bundled. For printer connections a different script is launched like this: Code: ;Printers--------------------------- ;Nieuwe printer script aanroepen --- call "08printers.kix" ;Nieuwe printer script aanroepen --- ;Printers--------------------------- Code: IF INGROUP ("P_arena_101") ADDPRINTERCONNECTION("\\$ASERVER\arena_101_blanco") ADDPRINTERCONNECTION("\\$ASERVER\arena_101_logo") ADDPRINTERCONNECTION("\\$ASERVER\arena_101_A3") ; SETDEFAULTPRINTER("\\$ASERVER\arena_101_Blanco") ELSE DELPRINTERCONNECTION("\\$ASERVER\arena_101_Blanco") DELPRINTERCONNECTION("\\$ASERVER\arena_101_Logo") DELPRINTERCONNECTION("\\$ASERVER\arena_101_A3") ENDIF This happens for about 30 printers, each with minimum 2 queues. This system does have its advantages, we transfer users from one printer to another by just putting them from one group into another. Mart told me to get rid of the gotos and batchfiles. I'd like to know if there is a better way for that? |
||||||||
|
|
|||||||
How long is "a long time"? How many resources are mapped? How many external scripts are run? Do you run scripts that rely on resources before they are mapped? Do you call batch files to perform tasks that can be done natively in Kix? How do you process group and OU logic? Are you doing it repeatedly, or just making the decisions once? Goto's won't generally affect performance, but make the code hard to follow and support. You can get rid of goto by, for example: Code: ; only run the win98 code for older systems, then exit If @DOS = '4.10' Call 'win98.kix' Exit 0 EndIf My login script (on my web site) is so tightly optimized that I need to make it wait so the user can verify that it ran. It processes about 30 resources and runs 3 external commands in under 4 seconds, including all of the group and ou-specific mapping logic. On the WAN, it takes about 9 seconds to run. Clearly, anything more than 15-20 seconds indicates that there is room for optimization. Glenn |
||||||||
|
|
|||||||
Originally Posted By: Glenn Barnas How long is "a long time"? How many resources are mapped? How many external scripts are run? Do you run scripts that rely on resources before they are mapped? Do you call batch files to perform tasks that can be done natively in Kix? How do you process group and OU logic? Are you doing it repeatedly, or just making the decisions once? Goto's won't generally affect performance, but make the code hard to follow and support. You can get rid of goto by, for example: Code: ; only run the win98 code for older systems, then exit If @DOS = '4.10' Call 'win98.kix' Exit 0 EndIf My login script (on my web site) is so tightly optimized that I need to make it wait so the user can verify that it ran. It processes about 30 resources and runs 3 external commands in under 4 seconds, including all of the group and ou-specific mapping logic. On the WAN, it takes about 9 seconds to run. Clearly, anything more than 15-20 seconds indicates that there is room for optimization. Glenn I will put in a measurement, but roughly around 20 seconds. Around 7 objects out of 50 possible are mapped, all based on group membership. A seperate group for each resource as well. Will get back on you with the exact time, then we know how much difference improvements can make. Thanks for the bit of code as well. To my opinion there are not so many goto's in the code. If there are three goto's than that's it. I'll get back to you about the time it takes for the script in whole to complete. |
||||||||
|
|
|||||||
I know there is a script / code you can add to your scripts to guage the exact time it taks for your script to run. Unfortunatly i don't remember what it was. If anyone remembers by this post please post for him if you know where to find it. If i find it, and no one has posted it i will put it up here for you. Thanks Indigo |
||||||||
|
|
|||||||
Ok i found it, its called DeltaTime: Put this in your code from the start and end, and it will show you how long it takes to run your code. You can also used this to pin-point what section of your code is taking a while, so you can narrow down what the issue is. Take Care Indigo Code: ;FUNCTION DeltaTime() ; ;AUTHOR Jochen Polster (jochenDOTpolsterATgmxDOTnet) ; ;VERSION 1.1 04/07/2004 - Fixed for NoVarsInStrings = 0N ; Milliseconds can now be omitted (if Zero) in one of the strings ; ;ACTION Calculates the time difference between two given times ; ;SYNTAX DeltaTime(Start,End) ; ;PARAMETERS Start (Required) ; - String value representing the starttime ; Format hh:mm:ss[:ms] ; ; End (Required) ; - String value representing the ending time ; Format hh:mm:ss[:ms] ; ;REMARKS Highest possible delta Value is 23:59:59:999 ! ; If the diff gets higher , the result will be incorrect. ; ;RETURNS The difference between Start - and Endtime in 'hh:mm:ss[:ms]' ; ;DEPENDENCIES KiXtart 4.0 ; ;EXAMPLES call "PATH\DeltaTime.udf" ; $start = @time + ':' + @msecs ; for $i = 0 to 15000 ; $ = @scriptdir ; next ; $end = @time + ':' + @msecs ; ? 'Start time : $start' ? ; ? 'End time : $end' ? ; $Duration = DeltaTime($start,$end) ; ? 'Duration : $Duration' ? ? ; ; $start = "21:59:59" ? 'Backup Started : $start' ? ; $end = "01:00:01" ? 'Backup Ended : $end' ? ; $d = DeltaTime($start,$end) ; ? 'Backup Duration : $d' ? ; ; get $k function DeltaTime($Start,$End) dim $, $s, $e, $MS_Start, $MS_End, $S_Start, $S_End, $total, $deltaH, $deltaM, $deltaS, $deltaMS, $i $s = split($Start,":") $e = split($End,":") if ubound($s) <> ubound($e) if ubound($s) > ubound($e) redim preserve $e[ubound($e)+1] $e[ubound($e)] = "000" else redim preserve $s[ubound($s)+1] $s[ubound($s)] = "000" endif endif for $i = 0 to ubound($s) $s[$i] = val($s[$i]) $e[$i] = val($e[$i]) next if ubound($s) = 3 $MS_Start = $s[3] + $s[2] * 1000 + $s[1] * 60000 + $s[0] * 3600000 $MS_End = $e[3] + $e[2] * 1000 + $e[1] * 60000 + $e[0] * 3600000 select case $MS_Start > $MS_End $total = 86400000 - ($MS_Start - $MS_End) case $MS_Start < $MS_End $total = $MS_End - $MS_Start case 1 $DeltaTime = "00:00:00:000" exit 1 endselect $deltaH = $total / 3600000 $total = $total - $deltaH * 3600000 $deltaM = $total / 60000 $total = $total - $deltaM * 60000 $deltaS = $total / 1000 $deltaMS = $total - $deltaS * 1000 else $S_Start = $s[2] + $s[1] * 60 + $s[0] * 3600 $S_End = $e[2] + $e[1] * 60 + $e[0] * 3600 select case $S_Start > $S_End $total = 86400 - ($S_Start-$S_End) case $S_Start < $S_End $total = $S_End - $S_Start case 1 $DeltaTime = "00:00:00" exit 1 endselect $deltaH = $total / 3600 $total = $total - $deltaH * 3600 $deltaM = $total / 60 $deltaS = $total - $deltaM * 60 endif $deltaH = right('0' + $deltaH, 2) $deltaM = right('0' + $deltaM, 2) $deltaS = right('0' + $deltaS, 2) if ubound($s) = 3 $deltaMS = right('00' + $deltaMS, 3) $DeltaTime = "" + $deltaH + ":" + $deltaM + ":" + $deltaS + ":" + $deltaMS else $DeltaTime = "" + $deltaH + ":" + $deltaM + ":" + $deltaS endif endfunction |
||||||||
|
|
|||||||
Actually, something as simple as Code: $STime = @TICKS ; your code goes here... 'This script took ' CDbl(@TICKS - $STime) / 1000.0 ' seconds to run.' ? Glenn |
||||||||
|
|
|||||||
This works here at home where i also use KIX. I have now to get this nice piece of code from Glenn in at work, and than see how long it takes to run there. I'll give an update as soon as i have the time |
||||||||
|
|
|||||||
hmm... speed improvements would in your case come from the network load. as example, instead of addprintercon, you could first check if the printer is already connected, thus removing possible driver download overload. |
||||||||
|
|
|||||||
Originally Posted By: Lonkero hmm... speed improvements would in your case come from the network load. as example, instead of addprintercon, you could first check if the printer is already connected, thus removing possible driver download overload. OK, now there's a thing that could work. Thanks Lonkero! To accomplish a check on existance of a certain connection, it is best to check on the presence of the printerconnection in the registry. I think i'm gonna dive into that one first. This is how it looks at the moment: Code: IF INGROUP ("P_arena_101") ADDPRINTERCONNECTION("\\$ASERVER\arena_101_blanco") ADDPRINTERCONNECTION("\\$ASERVER\arena_101_logo") ADDPRINTERCONNECTION("\\$ASERVER\arena_101_A3") ; SETDEFAULTPRINTER("\\$ASERVER\arena_101_Blanco") ELSE DELPRINTERCONNECTION("\\$ASERVER\arena_101_Blanco") DELPRINTERCONNECTION("\\$ASERVER\arena_101_Logo") DELPRINTERCONNECTION("\\$ASERVER\arena_101_A3") ENDIF Let's just sort out what needs to be there to skip this whole driver installation. |
||||||||
|
|
|||||||
Originally Posted By: Glenn Barnas Actually, something as simple as Code: $STime = @TICKS ; your code goes here... 'This script took ' CDbl(@TICKS - $STime) / 1000.0 ' seconds to run.' ? Glenn Thanks for very simple solution. Can i display this value in the messagebox i'm already having? |
||||||||
|
|
|||||||
I have redirected output to a file, so that i can at least see how long the script runs. Without any changes i'm having around 45 seconds. That's al mighty long time if you're waiting for it... |
||||||||
|
|
|||||||
I have now put this in: Code: IF INGROUP ("P_arena_103") KeyExist("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,Arena_103_Blanco\standaard") if @error="0" ADDPRINTERCONNECTION("\\$ASERVER\arena_103_blanco") ? "Arena_103_Blanco nieuw geinstalleerd" endif What this does is check for a value in the registry, if it is there, it will skip. I have tried this on my own account, so i only did the printers that i have connected, not the ones that i don't have, but are checked every run. I think i have to do the same for all the delprinterconnection commands as well... Will try and test more tomorrow or later this week |
||||||||
|
|
|||||||
Turns out this does not quite do the complete trick. You have to skip the lines that are not necasarry (spelling correct?) otherwis the system will look for a connection that isn't there. For testing purposes i have removed all the lines i'm not using in my case. This gives me a running time of 6,484 seconds. I think that is a real improvement. Now let's make a new template and a new printerscript (or put it in the main script @user.kix) |
||||||||
|
|
|||||||
you mean 6 and half seconds or 6500 seconds? |
||||||||
|
|
|||||||
hmm... you should add some printout before doing the call's to external files and after them... |
||||||||
|
|
|||||||
Originally Posted By: Lonkero you mean 6 and half seconds or 6500 seconds? Oh no! It's only 6 and a half seconds now! |
||||||||
|
|
|||||||
Originally Posted By: Lonkero hmm... you should add some printout before doing the call's to external files and after them... What do you mean by that? BTW. Calling the other script is done to keep the old commands for deleting the printers in, and install the new printers from a new fresh script. The windows 98 script is different from the standard script we use so i thought it was easier to maintanin when it was a seperate file |
||||||||
|
|
|||||||
I mean, you should log which part takes how much time, so you know which part is worth improving. |
||||||||
|
|
|||||||
Originally Posted By: Lonkero I mean, you should log which part takes how much time, so you know which part is worth improving. That's right, luckily i've found out that making the printerconnections takes the most time. It turned out that i kept making connections that were already there! Obviously there is no need for that. You only want to make the connection when it's not there and skip making the connection once you already have it. So far so good. If a person moves to another office, we just take him or her out of the original printer group, and into another. After a logout and in the new printer connection is there to use. I'm trying to get this to work by looking at the presence of a key in the registry with the "KEYEXIST" function. I have to check why it is not working. Something to do with the @error i think. |
||||||||
|
|
|||||||
For some strange reason this does not work: Code: IF INGROUP ("P_printer_###_***") KeyExist("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,printer_###_***\") if $Returncode = 0 ADDPRINTERCONNECTION("\\$ASERVER\printer_###_blanco") ? "printer_###_*** nieuw geinstalleerd" endif else Keyexist ("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,printer_###_***\") if $Returncode = 1 DELPRINTERCONNECTION("\\$ASERVER\printer_###_blanco") ? "printer_###_*** verwijderd" endif endif This is copied from the template i'm using. I'm connecting/disconnecting about 50 printers this way. I cannot imagine that this will be too much for Kixtart to handle in terms of mermory etc. Here is a of the report i'm getting: Code: Opened 'printers.log' from edscprinters.kix at 2008/10/02 15:33:13 0 Arena_101_Blanco nieuw geinstalleerd00 Arena_101_Kleur verwijderd0997 Arena_101_Opstel verwijderd01801 Arena_102_Blanco verwijderd01801 Arena_102_Logo verwijderd01801 Arena_102_A3 verwijderd01801 Arena_102_Kleur verwijderd111001801 Arena_104_Blanco verwijderd01801 Arena_104_Logo verwijderd01801 Arena_104_Supver verwijderd01801 Arena_104_Kidsclub verwijderd01801 Arena_104_A3 verwijderd01801 Arena_105_Blanco verwijderd01801 Arena_105_Logo verwijderd01801 Arena_105_A3 verwijderd01801 Arena_105_Kleur verwijderd11110997 Arena_121_Blanco verwijderd0997 Arena_121_Logo verwijderd000997 Arena_123_Blanco verwijderd0997 Arena_123_Logo verwijderd0997 Arena_124_Blanco verwijderd0997 Arena_124_Logo verwijderd0997 Arena_125_Blanco verwijderd0997 Arena_125_Logo verwijderd0997 Arena_126_Blanco verwijderd0997 Arena_126_Logo verwijderd0997 Arena_127_Blanco verwijderd0997 Arena_127_Logo verwijderd0997 Arena_128_Blanco verwijderd0997 Arena_128_Logo verwijderd0997 Arena_129_Blanco verwijderd0997 Arena_129_Logo verwijderd0997 Arena_130_Blanco verwijderd0997 Arena_130_Logo verwijderd0997 Arena_131_Blanco verwijderd0997 Arena_131_Logo verwijderd0997 Arena_131_Hand verwijderd000997 Arena_133_Blanco verwijderd0997 Arena_133_Logo verwijderd0997 Arena_134_Blanco verwijderd0997 Arena_134_Logo verwijderd0997 Arena_135_Blanco verwijderd0997 Arena_135_Logo verwijderd0997 Arena_136_Blanco verwijderd0997 Arena_136_Logo verwijderd0997 Arena_137_Blanco verwijderd0997 Arena_137_Logo verwijderd0997 Arena_138_Blanco verwijderd0997 Arena_138_Logo verwijderd0997 Arena_139_Blanco verwijderd0997 Arena_139_Logo verwijderd0997 Arena_140_Blanco verwijderd0997 Arena_140_Logo verwijderd0997 Arena_141_Blanco verwijderd0997 Arena_141_Logo verwijderd0997 Arena_142_Blanco verwijderd0997 Arena_142_Logo verwijderd0997 Arena_143_Blanco verwijderd0997 Arena_143_Logo verwijderd018010997 Rainbow_161_Blanco verwijderd0997 Rainbow_161_Logo verwijderd0997 Rainbow_162_Blanco verwijderd0997 Rainbow_162_Logo verwijderd0997 Toekomst_201_Blanco verwijderd0997 Toekomst_201_Logo verwijderd0997 Toekomst_201_A3 verwijderd0997 Toekomst_221_Blanco verwijderd0997 Toekomst_221_Logo verwijderd0997 Toekomst_222_Blanco verwijderd0997 Toekomst_222_Logo verwijderd0997 Toekomst_223_Blanco verwijderd0997 Toekomst_223_Logo verwijderd0997 Toekomst_224_Blanco verwijderd0997 Toekomst_224_Logo verwijderd0997 Toekomst_225_Blanco verwijderd0997 Toekomst_225_Logo verwijderd0997 Toekomst_226_Blanco verwijderd0997 Toekomst_226_Logo verwijderd0997 Toekomst_227_Blanco verwijderd0997 Toekomst_227_Logo verwijderd0997 Toekomst_228_Blanco verwijderd0997 Toekomst_228_Logo verwijderd0997 Toekomst_229_Blanco verwijderd0997 Toekomst_229_Logo verwijderd0997 Toekomst_230_Blanco verwijderd0997 Toekomst_230_Logo verwijderd0997 Toekomst_231_Blanco verwijderd0997 Toekomst_231_Logo verwijderd-1 The printerscript took 37,765 seconds to run. I'm kinda stuck here. Any help is greatly appreciated |
||||||||
|
|
|||||||
Try this, see if it works faster: Code: $WSHNetwork = CreateObject("WScript.Network") $WSHPrinters = $WSHNetwork.EnumPrinterConnections For $i=0 To WSHPrinters.Count -1 If Left($WSHPrinters.Item($i),2) = "\\" $WSHNetwork.RemovePrinterConnection($WSHPrinter.Items($i),1,1) EndIf Next |
||||||||
|
|
|||||||
I think you are missing an assignment. You check Keyexist, but don't store it's value anywhere and then in the next line assume the value is in the variable, $returncode. Try: Code: IF INGROUP ("P_printer_###_***") $Returncode = KeyExist("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,printer_###_***\") if $Returncode = 0 ADDPRINTERCONNECTION("\\$ASERVER\printer_###_blanco") ? "printer_###_*** nieuw geinstalleerd" endif else $Returncode = Keyexist ("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,printer_###_***\") if $Returncode = 1 DELPRINTERCONNECTION("\\$ASERVER\printer_###_blanco") ? "printer_###_*** verwijderd" endif endif |
||||||||
|
|
|||||||
BradV is right, Although to keep the script more in the type of code you put it in, I'd put it like this: Code: If InGroup("P_printer_###_***") If KeyExist("HKCU\Printers\Connections\,,AS-01,printer_###_***\") $=AddPrinterConnection("\\"+$ASERVER+"\printer_###_blanco") ? "printer_###_*** nieuw geinstalleerd"+"Error: "+@ERROR EndIf Else If KeyExist("HKCU\Printers\Connections\,,AS-01,printer_###_***\") $=DelPrinterConnection("\\"+$ASERVER+"\printer_###_blanco") ? "printer_###_*** verwijderd"+"Error: "+@ERROR EndIf EndIf |
||||||||
|
|
|||||||
Originally Posted By: BradV I think you are missing an assignment. You check Keyexist, but don't store it's value anywhere and then in the next line assume the value is in the variable, $returncode. Try: Code: IF INGROUP ("P_printer_###_***") $Returncode = KeyExist("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,printer_###_***\") if $Returncode = 0 ADDPRINTERCONNECTION("\\$ASERVER\printer_###_blanco") ? "printer_###_*** nieuw geinstalleerd" endif else $Returncode = Keyexist ("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,printer_###_***\") if $Returncode = 1 DELPRINTERCONNECTION("\\$ASERVER\printer_###_blanco") ? "printer_###_*** verwijderd" endif endif You are absolutely right! I have to do the assignment... |
||||||||
|
|
|||||||
Originally Posted By: apronk BradV is right, Although to keep the script more in the type of code you put it in, I'd put it like this: Code: If InGroup("P_printer_###_***") If KeyExist("HKCU\Printers\Connections\,,AS-01,printer_###_***\") $=AddPrinterConnection("\\"+$ASERVER+"\printer_###_blanco") ? "printer_###_*** nieuw geinstalleerd"+"Error: "+@ERROR EndIf Else If KeyExist("HKCU\Printers\Connections\,,AS-01,printer_###_***\") $=DelPrinterConnection("\\"+$ASERVER+"\printer_###_blanco") ? "printer_###_*** verwijderd"+"Error: "+@ERROR EndIf EndIf Many thanks to Bradv and Apronk. I will put Apronk's suggestions in and let you know how things turn out! |
||||||||
|
|
|||||||
Well, it's working! All of the script is normally running in under a second. That is of course when no printers need to be installed or removed. Even then however, all the work is done within 10 seconds wich is a great improvement compared to what it was before (around 50 seconds) Solved! |
||||||||
|
|
|||||||
That's good news. Thanks for the follow-up feedback. |
||||||||
|
|
|||||||
reduction to one fifth of what it used to be, that's already something. but was the improvement only because of the printer code enhancements? me just curious... as if so, you should have pretty slow network or server responding darn slowly. |
||||||||
|
|
|||||||
are you using roaming profiles? If so you can be assured that if you remove the printer connections .. they will remain even if you don't map them every single time. We used to map the pritners every time the computer booted at logon time. Toook for freeking ever.. well i removed the printer mappings and because we have roaming profiles the printers were already saved, so i don't have to worry about mapping them. Its been 6+ months now, and we still havn't had to run the printer mapping portion of our script. Also .. even if you re-load the system it will still remember the printers that were originally mapped because its in the roaming profile. anyway hope this helps. |
||||||||
|
|
|||||||
Roaming profiles But that is just a personal opinion. Had lots of issues with roaming profiles in the past so I avoid them like the plague nowadays. |
||||||||
|
|
|||||||
me too. |
||||||||
|
|
|||||||
KeyExist("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,printer_###_***\") if $Returncode = 0 ADDPRINTERCONNECTION("\\$ASERVER\printer_###_blanco") ? "printer_###_*** nieuw geinstalleerd" endif else There's an easier way to write this: if keyexist("registrykey")=0 dostuff endif just my 2 cent's worth.. |
||||||||
|
|
|||||||
easier? well, the original doesn't even work, so quess it would be easier to write a working version |
||||||||
|
|
|||||||
Originally Posted By: Lonkero reduction to one fifth of what it used to be, that's already something. but was the improvement only because of the printer code enhancements? me just curious... as if so, you should have pretty slow network or server responding darn slowly. Strange enough improvement came from not disconnecting a printer that was'nt ven connected in the first place. In the present we look for a printer connection. If that is not there, why bother trying to disconnect the thing? |
||||||||
|
|
|||||||
Originally Posted By: Indigo are you using roaming profiles? If so you can be assured that if you remove the printer connections .. they will remain even if you don't map them every single time. We used to map the pritners every time the computer booted at logon time. Toook for freeking ever.. well i removed the printer mappings and because we have roaming profiles the printers were already saved, so i don't have to worry about mapping them. Its been 6+ months now, and we still havn't had to run the printer mapping portion of our script. Also .. even if you re-load the system it will still remember the printers that were originally mapped because its in the roaming profile. anyway hope this helps. No, we are not using romaing profiles, but we like to change printer connections when a user starts using a different printer. For instance when he or she moves to a different location in the office and another printer is closer by. |
||||||||
|
|
|||||||
Originally Posted By: MattColeman KeyExist("HKEY_CURRENT_USER\Printers\Connections\,,AS-01,printer_###_***\") if $Returncode = 0 ADDPRINTERCONNECTION("\\$ASERVER\printer_###_blanco") ? "printer_###_*** nieuw geinstalleerd" endif else There's an easier way to write this: if keyexist("registrykey")=0 dostuff endif just my 2 cent's worth.. Yep you're right |