|
|
|||||||
hello guys, sometimes for my users here the kix script window is up for a long time. What can i add to my script to make the window disappear after a long time of being up. |
||||||||
|
|
|||||||
I think you best try to find first why the script window "hangs".
etc... |
||||||||
|
|
|||||||
I don't think it has any errors. this happens randomly with the PC's here in the domain. Most of the time the script runs and exits properly, but sometimes it just hangs. |
||||||||
|
|
|||||||
I did not want to say your script has errors. If it is about Startup/Shutdown/Logon/Logoff scripts, I think these run per default maximum 10 minutes. I think this can be changed via Group Policy Computer COnfiguration --> Administrative Templates --> System/Scripts --> Maximum wait time for group policy scripts But I presume that is not what you were looking for |
||||||||
|
|
|||||||
No i am not. I am just looking for something i could put in the script if it hangs for like 10 min then terminates |
||||||||
|
|
|||||||
If its any help i believe it hangs sometimes when the script connects to printers. |
||||||||
|
|
|||||||
Check if the printer is installed on the computer before installing it. PriMapState() is an UDF that can help speed up your logon script while mapping printers. |
||||||||
|
|
|||||||
is there anything else like a sleep for 10 min or exit function that would work. |
||||||||
|
|
|||||||
If you can post your script, I think a lot more can be suggested. |
||||||||
|
|
|||||||
If you're sure that adding printers is slowing down your login script, than I suggest you use PriMapState(). I think you should not add printers that are installed. Checking this will speed up your script. Code: ;;;;;;;;;;;;;;;;;; ; Script Options ; ;;;;;;;;;;;;;;;;;; If Not @LOGONMODE Break On Else Break Off EndIf Dim $RC $RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") If @SCRIPTEXE = "KIX32.EXE" $RC = SetOption("WrapAtEOL", "On") EndIf ;;;;;;;;;;;;;;;;;;;;; ; Declare variables ; ;;;;;;;;;;;;;;;;;;;;; Dim $DefaultPrinter Dim $Printer2 ;;;;;;;;;;;;;;;;;;;;;;;; ; Initialize variables ; ;;;;;;;;;;;;;;;;;;;;;;;; ; Change the values to your needs $DefaultPrinter = '\\YourServer\PrtAcc01' $Printer2 = '\\YourServer\PrtAcc02' ;;;;;;;; ; Code ; ;;;;;;;; If primapstate($Printer2) = '' AddPrinterConnection($Printer2) EndIf If PriMapState($DefaultPrinter) = '' $RC = AddPrinterConnection($DefaultPrinter) EndIf If primapstate($DefaultPrinter) = 1 $RC = SetDefaultPrinter($DefaultPrinter) EndIf ;;;;;;;;;;;;;;;;;;;;;;;; ; Personal UDF Section ; ;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ; UDF Section ; ;;;;;;;;;;;;;;; ; Add here the PriMapState() UDF |
||||||||
|
|
|||||||
And if you have a script that is "hanging", then having a timer built into the script would not do any good as it would be "hung" as well. Best is to find out what is causing the issue as others have stated and then deal with that issue. |
||||||||
|
|
|||||||
Here is the script!!!! Any help i would appreciate. Code: color w+/m ;change background color to yellow cls ;Clears the screen ?"Here is some information about your session:" ? ?"Current Computer Name: @wksta." ?"The Server you logged into: @lserver." ?"Your IP Address is: @ipaddress0." ? ?"Please wait while your login script connects all network resources..." IF @inwin=2 ?"Synchronizing your clock" settime "*" IF @error=0 ?"Your clock has been synchronized" ELSE ? color n/r "Your clock has NOT been synchronized" ?"You either do not have rights to change the time or" ?"A Time Server was unable to be located." color n/g ENDIF ENDIF ;Changes backround logon color to black. writevalue("hkey_users\.default\control panel\colors","background","0 0 0","REG_SZ") ? ?"Disconnecting all network drives..." use f: /del use g: /del use h: /del use i: /del use j: /del use k: /del use l: /del use m: /del use n: /del use o: /del use p: /del use q: /del use r: /del use s: /del use t: /del use v: /del use w: /del use x: /del use z: /del ;******************************************************************* ;Drive Mappings ;Server Name Variables $fileserver = "server1" $techserver = "server2" $newtechsrv = "server3" ? ?"Connecting all network drives..." use k: "\\$fileserver\P" use l: "\\$fileserver\S" ;******************************************************************* IF INGROUP("fso_Of") use j: "\\$fileserver\Of" ENDIF IF INGROUP("fso_m") use p: "\\$fileserver\Me" ENDIF IF INGROUP("fso_member_i") use i: "\\$fileserver\iM" ENDIF IF INGROUP("fso_fi") use s: "\\server1\SAGE" use f: "\\$fileserver\F" ENDIF IF INGROUP("fso_hr") use x: "\\$fileserver\H" ENDIF IF INGROUP("fso_me") use p: "\\$fileserver\M" ENDIF IF INGROUP("fso_ma") use p: "\\$fileserver\Co" ENDIF ;IF INGROUP("fso_marketing_creative") ; use q: "\\$fileserver\Creative" ;ENDIF IF INGROUP("fso_qa") use q: "\\$fileserver\QA" ENDIF IF INGROUP("fso_cha") use p: "\\$fileserver\C" ENDIF IF INGROUP("fso_pr") use h: "\\$fileserver\P" ENDIF IF INGROUP("fso_marketing_space") use o: "\\$fileserver\S" ENDIF IF INGROUP("fso_KT") use t: "\\$fileserver\K" ENDIF IF INGROUP("fso_cha") use m: "\\$fileserver\C" ENDIF IF INGROUP("fso_ex") use g: "\\$fileserver\E" ENDIF IF INGROUP("fso_re") use r: "\\$fileserver\R" ENDIF IF INGROUP("fso_t") use z: "\\$newtechsrv\T" ENDIF IF INGROUP("fso_dw") use w: "\\$fileserver\D" ENDIF IF INGROUP("fso_Re") use x: "\\$techserver\R" ENDIF IF INGROUP("fso_Re") use x: "\\$techserver\Recordings\%USERNAME%" ENDIF IF INGROUP("Non-Exempt Employees") copy "\\server5\NET\PunchINPunchOUT.url" "%USERPROFILE%\Start Menu\Programs\Startup\PunchINPunchOUT.url" ENDIF IF INGROUP("Domain Users") del "%USERPROFILE%\desktop\DatabaseCalender.lnk" ENDIF IF @wksta = "server1" or @wksta = "server2" GoTo Skip ENDIF IF @wksta = "server4" or @wksta = "server5" IF @userid = "Administrator" writevalue("HKEY_Current_user\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","StartMenuAdminTools","NO","REG_SZ") ENDIF ;Installs Printers for Terminal Server Users. ;?"Removing Old Printers..." ;SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /dn /n\\a02\X7665FIN /q" ;SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /dn /n\\a02\X7665MEM /q" ENDIF ;Installs printers for everybody. IF @wksta <> server6 ? ?"Installing Printers..." IF INGROUP("fso_t") ?"Mailroom printer install" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\XWC120PS /q" ENDIF SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\X7665FIN /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\X7665MEM /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\LJC2550PS3 /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\LJC3800PS /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\LJ4250NPS /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\LJ4250TN /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\LJ4250TN2 /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\LJ8100PCL6 /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\LJ8100PS /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\LJ4300PCL6 /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\MCROPLXF24 /q" SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\OJ7310 /q" ENDIF ;Changes setting for tabs in IE7 writevalue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing","ShortcutBehavior","0","REG_DWORD") ;Turns Internet Explorer start page to blank, enables recover deleted items in Outlook, enables num lock at logon, and sets IM and AutoArchive Preferences ;writevalue("hkey_Current_user\Software\Microsoft\Internet Explorer\Main","Start Page","about:blank","REG_SZ") ;writevalue("HKEY_USERS\.Default\Control Panel\Keyboard","InitialKeyboardIndicators","2","REG_SZ") writevalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Options","DumpsterAlwaysOn","1","REG_DWORD") writevalue("hkey_Current_user\Software\Microsoft\Internet Explorer\Main","Window Title","Provided by A A","REG_SZ") writevalue("hkey_Current_user\Software\Microsoft\Office\11.0\Outlook\IM","Enabled","0","REG_DWORD") writevalue("hkey_Current_user\Software\Microsoft\Office\11.0\Outlook\Preferences","DoAging","0","REG_DWORD") :Skip exit ;quits the login script |
||||||||
|
|
|||||||
If \\A01\X7665FIN is the full sharename to the printer you could replace a line like Code: SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\X7665FIN /q" by Code: If primapstate("\\A01\X7665FIN") = '' $RC = AddPrinterConnection("\\A01\X7665FIN") EndIf Do not forget to copy the PriMapState UDF code to your script, i.e. at the bottom |
||||||||
|
|
|||||||
I do not want to add printer deafults since everyone has a different default printer. I am a noob at kixtart, can you give me an example in what my code should look like. Is their anything i need to do to clean up the code to make the script run faster. Thanks |
||||||||
|
|
|||||||
I just gave an example. I will elaborate on the list of printers you are mapping. \\A01\LJ4250NPS \\A01\LJ4250TN \\A01\LJ4250TN2 Is that 1 printer with 3 print queues with different drivers? If yes, delete 2! Stick to your preferred driver. I.e. we prefer Pcl5 drivers for HP printers as they print faster For Canon copiers, we prefer UFR drivers Code: ; =========================================================================================== ; ; Script Information ; ; Title: ; Author: Wim Rotty ; Date: ; Description: ; ; ; =========================================================================================== ;;;;;;;;;;;;;;;;;; ; Script Options ; ;;;;;;;;;;;;;;;;;; If Not @LOGONMODE Break On Else Break Off EndIf Dim $RC $RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") If @SCRIPTEXE = "KIX32.EXE" $RC = SetOption("WrapAtEOL", "On") EndIf ;;;;;;;;;;;;;;;;;;;;; ; Declare variables ; ;;;;;;;;;;;;;;;;;;;;; Dim $Printers, $Printer ;;;;;;;;;;;;;;;;;;;;;;;; ; Initialize variables ; ;;;;;;;;;;;;;;;;;;;;;;;; $Printers = Split('' + '\\A01\X7665FIN' + '|' + '\\A01\X7665MEM' + '|' + '\\A01\LJC2550PS3' + '|' + '\\A01\LJC3800PS' + '|' + '\\A01\LJ4250NPS' + '|' + '\\A01\LJ4250TN' + '|' + '\\A01\LJ4250TN2' + '|' + '\\A01\LJ8100PCL6' + '|' + '\\A01\LJ8100PS' + '|' + '\\A01\LJ4300PCL6' + '|' + '\\A01\MCROPLXF24' + '|' + '\\A01\OJ7310' , '|') ;;;;;;;; ; Code ; ;;;;;;;; For Each $Printer in $Printers If primapstate($Printer) = '' $RC = AddPrinterConnection($Printer) EndIf Next ;;;;;;;;;;;;;;;;;;;;;;;; ; Personal UDF Section ; ;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ; UDF Section ; ;;;;;;;;;;;;;;; ; Do not forget to add the PriMapState UDF |
||||||||
|
|
|||||||
I would skip this and rethink about it Code: color w+/m ;change background color to yellow cls ;Clears the screen ?"Here is some information about your session:" ? ?"Current Computer Name: @wksta." ?"The Server you logged into: @lserver." ?"Your IP Address is: @ipaddress0." ? ?"Please wait while your login script connects all network resources..." IF @inwin=2 ?"Synchronizing your clock" settime "*" IF @error=0 ?"Your clock has been synchronized" ELSE ? color n/r "Your clock has NOT been synchronized" ?"You either do not have rights to change the time or" ?"A Time Server was unable to be located." color n/g ENDIF ENDIF ;Changes backround logon color to black. writevalue("hkey_users\.default\control panel\colors","background","0 0 0","REG_SZ")
|
||||||||
|
|
|||||||
Code: IF INGROUP("Domain Users") del "%USERPROFILE%\desktop\DatabaseCalender.lnk" ENDIF I would presume that all users are per default member of this group. I think it is better to check if you have to delete something to avoid error messages. |
||||||||
|
|
|||||||
Code: GoTo Skip Avoid the use of goto, as if you would use it more frequently, you will get attempted to create spagetti code. |
||||||||
|
|
|||||||
Code: WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Options", "DumpsterAlwaysOn", "1", "REG_DWORD") Most probably users will not be able to write to "HKEY_LOCAL_MACHINE" |
||||||||
|
|
|||||||
Pay attention. This is just a draft that YOU have to test. I will not be responsible for any damage or problems you cause on your domain. I am just making a suggestion to change your login script. I cannot test the script. It can contain errors. Use the things you like. Modify it to your needs. And most of all, test it step by step (i.e. start with putting most of the code in remark by adding ; ) Code: ; =========================================================================================== ; ; Script Information ; ; Title: ; Author: Wim Rotty ; Date: ; Description: ; ; ; =========================================================================================== ;;;;;;;;;;;;;;;;;; ; Script Options ; ;;;;;;;;;;;;;;;;;; If Not @LOGONMODE Break On Else Break Off EndIf Dim $RC $RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") If @SCRIPTEXE = "KIX32.EXE" $RC = SetOption("WrapAtEOL", "On") EndIf ;;;;;;;;;;;;;;;;;;;;; ; Declare variables ; ;;;;;;;;;;;;;;;;;;;;; Dim $Printers, $Printer Dim $Drives, $Drive ; Server Name Variables Dim $fileserver Dim $techserver Dim $newtechsrv ;;;;;;;;;;;;;;;;;;;;;;;; ; Initialize variables ; ;;;;;;;;;;;;;;;;;;;;;;;; $Drives = Split('f:|g:|h:|i:|j:|k:|l:|m:|n:|o:|p:|q:|r:|s:|t:|u:|v:|w:|x:|y:|z:','|') $Printers = Split('' + '\\A01\X7665FIN' + '|' + '\\A01\X7665MEM' + '|' + '\\A01\LJC2550PS3' + '|' + '\\A01\LJC3800PS' + '|' + '\\A01\LJ4250NPS' + '|' + '\\A01\LJ4250TN' + '|' + '\\A01\LJ4250TN2' + '|' + '\\A01\LJ8100PCL6' + '|' + '\\A01\LJ8100PS' + '|' + '\\A01\LJ4300PCL6' + '|' + '\\A01\MCROPLXF24' + '|' + '\\A01\OJ7310' , '|') ; Server Name Variables $fileserver = 'server1' $techserver = 'server2' $newtechsrv = 'server3' ;;;;;;;; ; Code ; ;;;;;;;; ; Disconnecting all network drives... For Each $Drive in $Drives Use $Drive /del Next ; Drive Mappings Use k: '\\' + $fileserver + '\P' Use l: '\\' + $fileserver + '\S' If InGroup('fso_Of') Use j: '\\' + $fileserver + '\Of' EndIf If InGroup('fso_m') Use p: '\\' + $fileserver + '\Me' EndIf If InGroup('fso_member_i') Use i: '\\' + $fileserver + '\iM' EndIf If InGroup('fso_fi') Use s: '\\server1\SAGE' Use f: '\\' + $fileserver + '\F' EndIf If InGroup('fso_hr') Use x: '\\' + $fileserver + '\H' EndIf If InGroup('fso_me') Use p: '\\' + $fileserver + '\M' EndIf If InGroup('fso_ma') Use p: '\\' + $fileserver + '\Co' EndIf ;IF INGROUP('fso_marketing_creative') ; use q: '\\' + $fileserver + '\Creative' ;ENDIF If InGroup('fso_qa') Use q: '\\' + $fileserver + '\QA' EndIf If InGroup('fso_cha') Use p: '\\' + $fileserver + '\C' EndIf If InGroup('fso_pr') Use h: '\\' + $fileserver + '\P' EndIf If InGroup('fso_marketing_space') Use o: '\\' + $fileserver + '\S' EndIf If InGroup('fso_KT') Use t: '\\' + $fileserver + '\K' EndIf If InGroup('fso_cha') Use m: '\\' + $fileserver + '\C' EndIf If InGroup('fso_ex') Use g: '\\' + $fileserver + '\E' EndIf If InGroup('fso_re') Use r: '\\' + $fileserver + '\R' EndIf If InGroup('fso_t') Use z: '\\' + $newtechsrv + '\T' EndIf If InGroup('fso_dw') Use w: '\\' + $fileserver + '\D' EndIf If InGroup('fso_Re') Use x: '\\' + $techserver+ '\R' EndIf If InGroup('fso_Re') Use x: '\\' + $techserver + '\Recordings\%USERNAME%' EndIf If InGroup('Non-Exempt Employees') Copy '\\server5\NET\PunchINPunchOUT.url' '%USERPROFILE%\Start Menu\Programs\Startup\PunchINPunchOUT.url' EndIf If Exist('%USERPROFILE%\desktop\DatabaseCalender.lnk') Del '%USERPROFILE%\desktop\DatabaseCalender.lnk' EndIf If Not @wksta = "server1" Or Not @wksta = "server2" If @wksta = "server4" Or @wksta = "server5" If @userid = "Administrator" $RC = WriteValue("HKEY_Current_user\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "StartMenuAdminTools", "NO", "REG_SZ") EndIf EndIf ;Installs printers for everybody. If @wksta <> 'server6' ; Installing Printers... If InGroup("fso_t") ; Mailroom printer install If PriMapState('\\A01\XWC120PS') = '' $RC = AddPrinterConnection('\\A01\XWC120PS') EndIf EndIf For Each $Printer in $Printers If PriMapState($Printer) = '' $RC = AddPrinterConnection($Printer) EndIf Next EndIf ;Changes setting for tabs in IE7 $RC = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing", "ShortcutBehavior", "0", "REG_DWORD") ;Turns Internet Explorer start page to blank, enables recover deleted items in Outlook, and sets IM and AutoArchive Preferences $RC = WriteValue("hkey_Current_user\Software\Microsoft\Internet Explorer\Main", "Window Title", "Provided by A A", "REG_SZ") $RC = WriteValue("hkey_Current_user\Software\Microsoft\Office\11.0\Outlook\IM", "Enabled", "0", "REG_DWORD") $RC = WriteValue("hkey_Current_user\Software\Microsoft\Office\11.0\Outlook\Preferences", "DoAging", "0", "REG_DWORD") EndIf ;;;;;;;;;;;;;;;;;;;;;;;; ; Personal UDF Section ; ;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ; UDF Section ; ;;;;;;;;;;;;;;; ; Do not forget to add the PriMapState UDF |
||||||||
|
|
|||||||
Its working great, but one thing is that i think the script is making multiple copies of printers under "printers and faxes" |
||||||||
|
|
|||||||
I don't get it Every shared printer can only be added once. If it is added a second time, it overwrites the existing one. I presume that Code: SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\X7665FIN /q" does the same as Code: $RC = AddPrinterConnection('\\A01\X7665FIN') PriMapState helps to verify if the printer has been added before to prevent that the printer is added over and over again. |