Page 1 of 1 1
Topic Options
#202556 - 2011-07-04 02:11 AM kix login script taking 1-5 minutes to login
coparofl Offline
Fresh Scripter

Registered: 2011-06-28
Posts: 5
Loc: Sydney, Australia
hi everyone,

please be patient with me I am new to kix and the forums,

I have been tasked to help speed up the login process at my clients site, however I am not familiar with kix scripting at all.

I was wondering if you beautiful people on the forums could help me

I've attached the current kix login script for reference.

is the script inefficient? are there better ways of doing the logon process?

 Code:
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;  The Benevolent Society
;  Enterprise Logon Script
;
;  Last Ammended:  20.05.2010 by Brendan

;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$CG = "g+/n" ; Good Colour (Green)
$CB = "r+/n" ; Bad Colour (Red)
$CN = "w/n" ; Normal Colour (White)
;IF _ERR = 0 COLOR $CG "   Done" COLOR $CN ELSE COLOR $CB "   Failed" COLOR $CN ENDIF

; Check to see if the user is running in a Terminal Session
If @TSSESSION ? "This is a Production Terminal Services Session" ?
	    
	;------------------------------------------------------
	; DRIVE MAPPINGS
	;------------------------------------------------------
	
	; Cleanup and map global drives
	? "Mapping user drives..."
	Use "*" /delete
	Use H:\\ * .local\dfs\ctxusers\%USERNAME%
	Use J:\\ * .local\dfs\data
	Use S:\\ * .local\dfs\shared
	Use T:\\ * .local\dfs\applications
	Use W:\\ * .local\dfs\tsprof\%USERNAME%
	Use X:\\ * .local\dfs\mailarch\%USERNAME%
	" [ Completed ]"
	
	; Map the P: drive depending on user group access.  Only the first matching CASE will be run
	? "Mapping P drive..."
	Select
			
		Case InGroup("LOS_Multi")
			Use P:\\ * .local\dfs\Program
			
		Case InGroup("LOS_CCH")
			Use P:\\ * .local\dfs\Program\CCH
			
		Case InGroup("LOS_ECS")
			Use P:\\ * .local\dfs\Program\ECS
			
		Case InGroup("LOS_NENWSWNSW")
			Use P:\\ * .local\dfs\Program\NENWSWNSW
			
		Case InGroup("LOS_FYL")
			Use P:\\ * .local\dfs\Program\FYL
			
		Case InGroup("LOS_PA")
			Use P:\\ * .local\dfs\Program\PA
			
		Case InGroup("LOS_QLD")
			Use P:\\ * .local\dfs\Program\QLD
			
		Case InGroup("LOS_RA")
			Use P:\\ * .local\dfs\Program\RA
			
		Case InGroup("LOS_SLA")
			Use P:\\ * .local\dfs\Program\SLA
			
		Case InGroup("LOS_SS")
			Use P:\\ * .local\dfs\Program\SS
			
		Case InGroup("LOS_SWS")
			Use P:\\ * .local\dfs\Program\SWS
	EndSelect
	" [ Completed ]"
	
	
	;------------------------------------------------------
	; FLEX PROFILES SETUP
	;------------------------------------------------------
	? "Restoring FLEX Profile..."
	;Run the Flex Framework scripts and settings
	Shell 'cscript /nologo "%PROGRAMFILES%\Immidio\Flex Profiles\Flex_Framework.vbs" LOGON "\\*.local\netlogon\Flex_Config"'
	" [ Completed ]"
	    
	;------------------------------------------------------
	; DESKTOP ENVIRONMENT SETUP
	;------------------------------------------------------
	? "Building Desktop and Start Menu..."
	RedirectOutput(NUL, 1)
	;Copy Policies and Procedures shortcut to desktop
	;IF EXIST("H:\Desktop\Forms Index.lnk") = 0
	;SHELL 'robocopy "\\*.local\dfs\tsprof\template\Desktop" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	
	;IF EXIST("H:\Desktop\Policies and Procedures Index.lnk") = 0
	Shell 'robocopy "\\*.local\dfs\tsprof\template\Desktop" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	
	If InGroup("FA_BF_ALLSTAFF")
		Shell 'robocopy "\\*.local\dfs\shared\Operations\Brighter Futures" "H:\Desktop" "Brighter Futures Assessment Tool.pdf.lnk" /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Shell 'robocopy "\\*.local\dfs\shared\Operations\Brighter Futures" "H:\Desktop" "User Guide - Brighter Futures Assessment Tool.pdf.lnk" /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	
	;Copy the First-Run key for each user
	If Exist("W:\SETTINGS\FLEX\Outlook2003.zip")
		$_outlookset = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Outlook\Setup", "First-Run")
		WriteValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\11.0\Outlook\Setup", "First-Run", $_outlookset, "REG_BINARY")
	EndIf
	
	;Build the start menu based on user group access
	Shell 'robocopy "\\*.local\dfs\tsprof\template\common\Start Menu" "%USERPROFILE%\Start Menu" * /MIR /E /R:0 /W:1 /LOG:"%TEMP%\login.log"'
	
	If InGroup("AP_StarCareMOS")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\StarCareMOS\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Use L:\\ * .local\dfs\Applications\StarcareUI\%USERNAME%
	EndIf
	
	If InGroup("AP_BESS")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\BESS" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
				
	EndIf
	
	If InGroup("Domain Users")
		;SHELL 'robocopy "\\*.local\dfs\tsprof\template\Intranet" "%USERPROFILE%\Start Menu\Programs\Startup" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Shell 'robocopy "\\*.local\dfs\tsprof\template\Intranet_1\Desktop" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
				
	EndIf
	
	If InGroup("AP_BESS_TEST")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\BESS_TEST" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		
	EndIf
	
	If InGroup("AP_MOODLE")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\MOODLE" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		
	EndIf
	
	If InGroup("AP_LACES")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\LACES" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		
	EndIf
	
	If InGroup("AP_ServiceDesk")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\ServiceDesk" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		
	EndIf
	
	If InGroup("AP_Avaya_ContactStore")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\Avaya_ContactStore" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		
	EndIf
	
	If InGroup("AP_Avaya_CCR")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\Avaya_CCR" "H:\Desktop" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		
	EndIf
	
	If InGroup("AP_ICON_REMOVE")
		Del("H:\Desktop\Service Desk.url")
				
	EndIf
	
	If InGroup("AP_StarCareSPB")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\StarCareSPB\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Use L:\\ * .local\dfs\Applications\StarcareUI\%USERNAME%
	EndIf
	If InGroup("AP_StarCareFinance")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\StarCareFinance\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Use L:\\ * .local\dfs\Applications\StarcareUI\%USERNAME%
	EndIf
	If InGroup("AP_Publisher")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\Publisher\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_Project")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\Project\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_Visio")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\Visio\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Call "\\*.local\netlogon\visio11.kix"
	EndIf
		
	;IF INGROUP("AP_Heat")
	;SHELL 'robocopy "\\*.local\dfs\tsprof\template\Heat\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	;IF INGROUP("AP_ActiveSync")
	;SHELL 'robocopy "\\*.local\dfs\tsprof\template\ActiveSync\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	If InGroup("AP_AcroWriter")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\AcroWriter\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_Finance")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\AcroWriterx\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	;IF INGROUP("AP_Finance")
	;SHELL 'robocopy "\\*.local\dfs\tsprof\template\finance\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	If InGroup("AP_GreatPlains")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\GP\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_CHRIS21")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\Chris21\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Use Q:\\hodb01\data\chris21
	EndIf
	If InGroup("Citrix Admin Shadow Only")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\Shadow\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_MealManager")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\MealManager37\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Use G:\\aud5500046\scanning
	EndIf
	If InGroup("AP_ANSTAT")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\ANSTAT\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_CFCCSSS")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\CFCCSSS\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_FRxViewer")
		Shell 'robocopy "\\*.local\dfs\TSProf\template\FRxViewer\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_FRxDesigner")
		Shell 'robocopy "\\*.local\dfs\TSProf\template\FRxDesigner\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_FRxAdmin")
		Shell 'robocopy "\\*.local\dfs\TSProf\template\FRxAdmin\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Use Y:\\pawb02\FRxWebPort
	EndIf
	;IF INGROUP("AP_OpenAlms")
	;SHELL 'robocopy "\\*.local\dfs\TSProf\template\OpenAlms\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	;IF INGROUP("AP_CRC")
	;SHELL 'robocopy "\\*.local\dfs\TSProf\template\crc\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	If InGroup("AP_Carelink")
		Shell 'robocopy "\\*.local\dfs\TSProf\template\carelink\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_PARCDB")
		Shell 'robocopy "\\*.local\dfs\TSProf\template\PARC\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_PARCQLD")
		Shell 'robocopy "\\*.local\dfs\TSProf\template\PARCQLD\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_BFD_UI")
		Shell 'robocopy "\\*.local\dfs\TSProf\template\BFD\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Use N:\\ * .local\dfs\Applications\BFDUI\%USERNAME%
	EndIf
	If InGroup("AP_ThankQ")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\ThankQ\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
		Call "\\*.local\netlogon\thankq.kix"
	EndIf
	;IF INGROUP("AP_Nvivo")
	;SHELL 'robocopy "\\*.local\dfs\tsprof\template\Nvivo\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	;IF INGROUP("AP_Hartmann")
	;SHELL 'robocopy "\\*.local\dfs\tsprof\template\Hartmann\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	;ENDIF
	If InGroup("AP_TCM_Compacks")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\TCMcompack\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_EndNote")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\EndNote\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_TCM7")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\TCM7\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_ACSAA")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\ACSAA\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_ClientManager")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\ClientManager\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("AP_Finance")
		Shell 'robocopy "\\*.local\dfs\tsprof\template\GP2010\Start Menu" "%USERPROFILE%\Start Menu" * /E /R:0 /W:1 /LOG+:"%TEMP%\login.log"'
	EndIf
	If InGroup("LS_ThankQ")
		Use M:\\HODB01\Admit
	EndIf
	
	If InGroup("Domain Users")
		$Folder = '\\*.LOCAL\NETLOGON\REGFILES\'
		$File = 'Outlook_Fonts.reg'
		Shell '%WINDIR%\regedit.exe /S ' + $Folder + $File
		Del("C:\Documents and Settings\%Username%\Application Data\Microsoft\Internet Explorer\Quick Launch\Launch Microsoft Office Outlook.lnk")
	EndIf
	
	    
	RedirectOutput("", 1)
	" [ Completed ]"
	    
	;Windows Taskbar setings, no clock
	If InGroup("Domain Users")
		? "Setting taskbar..."
		WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", "28000000ffffffff02000000030000003c0000001e000000feffffff3c020000220300005a020000", "REG_BINARY")
		" [ Completed ]"
	EndIf
	
	;Time entries required for CareManager
	If InGroup("AP_TCM7")
		? "Time settings for CareManager..."
		WriteValue("HKEY_CURRENT_USER\Control Panel\International", "s1159", "AM", "REG_SZ")
		WriteValue("HKEY_CURRENT_USER\Control Panel\International", "s2359", "PM", "REG_SZ")
		" [ Completed ]"
	EndIf
	    
	;Set Multilingual Keyboard Layouts
	If InGroup("AP_Multilingual")
		? "Loading keyboard layouts..."
		WriteValue("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "00000c09", "REG_SZ") ;English (Australian)
		WriteValue("HKEY_CURRENT_USER\Keyboard Layout\Preload", "2", "00003001", "REG_SZ") ;Arabic (Lebanon)
		WriteValue("HKEY_CURRENT_USER\Keyboard Layout\Preload", "3", "00000409", "REG_SZ") ;English (United States)
		WriteValue("HKEY_CURRENT_USER\Keyboard Layout\Preload", "4", "0000042a", "REG_SZ") ;Vietnamese
		WriteValue("HKEY_CURRENT_USER\Keyboard Layout\Preload", "5", "0000040d", "REG_SZ") ;Hebrew
		" [ Completed ]"
	EndIf      
	
	
	;Allow Flash Domains
	If InGroup("Domain Users")
		? "Loading Flash Domains..."
		Call "\\*.local\netlogon\Flash.kix"
		" [ Completed ]"
	EndIf
	
	
	;Adobe Reader settings, Open Cross-Documents
	If InGroup("Domain Users")
		? "Setting Adobe Reader..."
		WriteValue("HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\Originals", "bOpenInPlace", "00000000", "REG_DWORD")
		WriteValue("HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\Originals", "bBrowserIntegration", "00000001", "REG_DWORD")
		WriteValue("HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\FormsPrefs", "bInlineAutoComplete", "00000000", "REG_DWORD")
		WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins\crmaddin.Addin", "LoadBehavior", "2", "REG_DWORD")
		WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\crmexceladdin.Addin", "LoadBehavior", "2", "REG_DWORD")
		" [ Completed ]"
		Del("C:\Documents and Settings\%Username%\Application Data\Microsoft\Internet Explorer\Quick Launch\Desktop.ini")
	EndIf
	
	;MS CRM
	If InGroup("UserGroup {3c7fb4c4-ad64-4b18-8250-65434910cbb8}")
		? "ENABLE OUTLOOK CLIENT for CRM"
		Call "\\*.local\netlogon\crm.kix"
		" [ Completed ]"
	EndIf
	   
	? "Connecting Thin Print..."
	Shell 'cmd /c "tpautoconnect -v -q > h:\tpautoconnect.log"'
	" [ Completed ]"
	    
	;------------------------------------------------------
	; Deleting printers
	;------------------------------------------------------
	? "Deleting Printers..."
	Shell 'cscript \\*.local\netlogon\delete_printers.vbs'
	;get$
	   	
	
EndIf



any help would be greatly appreciated.

thanks in advance
andrew.


Attachments
TBSLogon.kix (328 downloads)
Description:




Edited by Mart (2011-07-04 09:21 AM)

Top
#202557 - 2011-07-04 09:20 AM Re: kix login script taking 1-5 minutes to login [Re: coparofl]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I added the script to your post instead of having it as an attachment. This makes it a bit easier to see what might be going on without downloading the script.
First things that come to mind.

- You are calling the Flex_Framework.vbs script from inside the kix script. It might be this vbs script that is slowing things down. It might be running slow or it has a huge list of things to do.
- I see you use * for the server or domain name when mapping drives. I guess this is done to hide the server names. If not then please add the server names (set them at the top of the script and use the variable wherever needed).
- You display some info in the screen. Is there any part where it shows that it is slow? Info shown as it should but the next line takes forever to come up?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202558 - 2011-07-04 05:43 PM Re: kix login script taking 1-5 minutes to login [Re: Mart]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
You've got so many calls and shells to other scripts/programs it's really no telling where the hang up is.

I'd start by putting in some debug code in each section and displaying this information to the screen, so you know where the script is at a specific time and then can watch when it hangs. The problem is, with so many groups this could be somewhat tedious. Creating a log file for each user with sections and time stamps might be more suitable.

The other thing that might help is to check the values before trying to change them. I mean why keep setting values over and over. It adds code to your script, but a read is always faster than a write.

below is just a quick sudo example... you will need to format functions properly for them to work.
 Code:
If not exist("somefile")
  copy "somefile"
endif

if readvalue("somevalue")<>"blah"
  $RC=writevalue("somevalue")
endif

Top
#202561 - 2011-07-05 02:20 AM Re: kix login script taking 1-5 minutes to login [Re: Allen]
coparofl Offline
Fresh Scripter

Registered: 2011-06-28
Posts: 5
Loc: Sydney, Australia
Hi Mart, Allan.

Mart - I think your correct, The Restoring FLEX Profile..."
seems to be taking the longest to load. so i should try and seperate that from the kix script?

Allan - I totally agree, I need to setup some sort of debugging with timestamps on the login script, how do i do that though?

Top
#202562 - 2011-07-05 05:14 AM Re: kix login script taking 1-5 minutes to login [Re: coparofl]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
Here is one way...

WriteLog2() - Writes to a specified log file with optional TimeStamp
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=83049#Post83049

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1

Top
#202563 - 2011-07-05 06:11 AM Re: kix login script taking 1-5 minutes to login [Re: Allen]
coparofl Offline
Fresh Scripter

Registered: 2011-06-28
Posts: 5
Loc: Sydney, Australia
Hi Allen.

I tried the above but cant get it to work yet,

i pasted Function
 Code:
Function WriteLog2($File, $Text, optional $TimeStamp)
   ;ACTION: Writes text to a specified log file.
   dim $RC, $File, $text, $FH, $TimeStamp
   $FH=1
   $RC=Open ($FH, $File, 5)
   while $RC = -3
      $FH=$FH +1
      $RC=Open ($FH, $File, 5)
   Loop
   Select
      Case $RC=0
            if ($TimeStamp=1)
               $TimeStamp = @Date + " " + @Time + " - "
            else
               $TimeStamp = ""
            endif
            $RC=Writeline ($FH, $TimeStamp + $Text + @CRLF)
            $RC=Close ($FH)
      Case $RC=-2
         $text = WriteLog2 ("junk.txt","This is a test",1)
: Invalid file handle ($FH) specified when trying to Open $File."
         $RC=MessageBox ($text,"Script Error",48)
      Case $RC=-1
         $text = "WriteLog2 ("junk1.txt","This is a test",1): Invalid file name ($File) specified for log file."
         $RC=MessageBox ($text,"Script Error",48)
      Case $RC=>0
         $text = "System Error($RC) while attempting to open log file ($File)."
         $RC=MessageBox ($text,"Script Error",48)
   Endselect
EndFunction

its actually now not even running the login script. lol.


Edited by Mart (2011-07-06 09:23 AM)
Edit Reason: Please use code tags when posting code.

Top
#202564 - 2011-07-05 06:58 AM Re: kix login script taking 1-5 minutes to login [Re: coparofl]
coparofl Offline
Fresh Scripter

Registered: 2011-06-28
Posts: 5
Loc: Sydney, Australia
ok it comes up with the error message.

error : missing endfunction for [writelog2]!
script \\*.local\netlogon\agtbslogon.kix

Top
#202566 - 2011-07-05 12:06 PM Re: kix login script taking 1-5 minutes to login [Re: coparofl]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
A few other things:

1. Are all of the servers and workstations on the same local network? Are there any firewalls or WAN connections involved?

2. I see another vbs script to delete printers. Take a look at that and see if it can be moved into native kix.

3. I'm not familiar with flex framework. I found Flex Profile Kit. Is this what you are using here?

Regards,

Brad

Top
#202575 - 2011-07-05 09:02 PM Re: kix login script taking 1-5 minutes to login [Re: BradV]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
 Quote:
ok it comes up with the error message.

error : missing endfunction for [writelog2]!
script \\*.local\netlogon\agtbslogon.kix


Something must have went wrong on the copy/paste. I get the same error as you when I use the function as you posted it above. But if I copy it from the link above and paste that version, it works fine. Try re-copying and pasting again...from here...

WriteLog2() - Writes to a specified log file with optional TimeStamp
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=83049#Post83049

Top
#202588 - 2011-07-07 06:55 AM Re: kix login script taking 1-5 minutes to login [Re: ShaneEP]
coparofl Offline
Fresh Scripter

Registered: 2011-06-28
Posts: 5
Loc: Sydney, Australia
shane i cant get it to work?
i have a couple of questions do i need to specifiy a $file option?

for example does $file=\\servername\temp, how does it know where to place junk.txt?

second. i cant get it to work. lol help!

Top
#202591 - 2011-07-07 11:23 AM Re: kix login script taking 1-5 minutes to login [Re: coparofl]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I see that you made some changes in the WriteLog2 UDF. DUDF's are ready for use and do not need to be modified. All you need to do is include them in the code or call them from your code. See the example below on how to use the WriteLog2 UDF.
This code:
 Code:
Break on

$file = "c:\logfile.txt"

$rc = WriteLog2($file, "This is a test")
$rc = WriteLog2($file, "This is a test",0)
$rc = WriteLog2($file, "This is a test",1)


;FUNCTION         WriteLog2()
;
;AUTHOR           Howard A. Bullock (hbullock@tycoelectronics.com)
;
;ACTION           Generic logging facility for scripts. Appends log entry to a file with an optional TimeStamp.
;
;SYNTAX           WriteLog2($File, $text, [0|1])
;
;PARAMETERS       $File (Required) -  String value
;                 $text (Required) -  String value
;                 $TimeStamp (Optional) Default(0) no TimeStamp (1 or 0)
;
;
;REMARKS          This function writes (appends) an optionally time stamped log entry to the file defined in function.
;                 This function searches for the first unused file handle, open the file, and write the entry. T he file handle
;                 is then closed. When the function is unable to perform its it write the error is displayed&nbs p;in a message box.
;
;RETURNS          Nothing
;
;DEPENDENCIES     None
;
;EXAMPLES         WriteLog2("junk.txt","This is a test")
;                 WriteLog2("junk.txt","This is a test",0)
;                 WriteLog2("junk.txt","This is a test",1)
;
;
Function WriteLog2($File, $Text, optional $TimeStamp)
	;ACTION: Writes text to a specified log file.
	Dim $RC, $File, $text, $FH, $TimeStamp
	$FH = 1
	$RC = Open($FH, $File, 5)
	While $RC = -3
		$FH = $FH + 1
		$RC = Open($FH, $File, 5)
	Loop
	Select
		Case $RC = 0
			If ($TimeStamp = 1)
				$TimeStamp = @Date + " " + @Time + " - "
			Else
				$TimeStamp = ""
			EndIf
			$RC = WriteLine($FH, $TimeStamp + $Text + @CRLF)
			$RC = Close($FH)
		Case $RC = -2
			$text = "WriteLog2: Invalid file handle ($FH) specified when trying to Open $File."
			$RC = MessageBox($text, "Script Error", 48)
		Case $RC = -1
			$text = "WriteLog2: Invalid file name ($File) specified for log file."
			$RC = MessageBox($text, "Script Error", 48)
		Case $RC = > 0
			$text = "System Error($RC) while attempting to open log file ($File)."
			$RC = MessageBox($text, "Script Error", 48)
	EndSelect
EndFunction


will give you:
 Quote:

This is a test
This is a test
2011/07/07 11:20:05 - This is a test
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202594 - 2011-07-07 02:58 PM Re: kix login script taking 1-5 minutes to login [Re: coparofl]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
If you are talking about the first parameter to writelog2, then $file should point to the location of the log file. It could be:

 Code:
$file = "c:\temp\mylogfile.txt"
or
 Code:
$file = "\\servername\share\temp\mylogfile.txt"


Regards,

Brad

Top
#202964 - 2011-08-24 01:40 PM Re: kix login script taking 1-5 minutes to login [Re: BradV]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
I'd start thinking about structuring that up a bit, that's one long script to try to read.

The question I'm itching to ask is - have you seen any pattern to where the slowdowns occur - region-based / machine type based / office/unit based?


Edited by Björn (2011-08-24 01:42 PM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 323 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.067 seconds in which 0.024 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org