garyk
(Just in Town)
2016-03-16 10:07 PM
Script randomly works randoly doesn't

Hello,
I have been having an issue with KIX32.exe for the past two months that I am unable to figure out. I’m not 100% sure if it is even an issue with KIX or not, but perhaps someone has experienced similar issues or can point me in the right direction.

We are currently running KIX.32 v4.51, it has been working for at least the past three years. The Kix32.exe is located in our netlogon folder, and our students are mapped to it through their active directory profile. Pretty much all we are using it for is to map lab printers to the computers when the student logs in. All of our computer labs are running Windows 7.

Anyhow here is the problem. Sometimes the printer won’t load for some individuals (not sure if the KIX loads or not when this happens). Case in point, a class this morning KIX loaded the printer for all students, second class only half of the class had their printers loaded, then the third class all printers loaded again. In the open labs this issue is random some students will have their printers loaded, but then some don’t. When I spot check it typically works fine for me, but I have seen it where nothing happened. Our labs are fairly small around 30 computers max.

I initially the issue could be coming from one of the Domain Controllers (we have 2, server 2008 R2), but I had reports that troubled users have been logged on to either of the DCs, it has been about 50/50.

I thought since we had an older version of KIX that I would update it to the latest version, but it caused me more problems. I did an upgrade to 4.66 and when I tested in the lab of 15 only 4 computers had their printers load. I went back to the 4.51 version and when I again tested all 15 machines printers loaded.

Anyone experience anything like this? Any suggestions or advice would be helpful, I am at the end any ideas I have. Next step that one of our Techs wants to do is to start writing printerui bat, but I would prefer to stay with KIX.

Thanks

Gary


Glenn BarnasAdministrator
(KiX Supporter)
2016-03-17 12:30 PM
Re: Script randomly works randoly doesn't

First thing to do is verify replication between the DCs and make sure that the NetLogon folders are in-sync. I've seen one DC not sync this folder (out of 5) and lost most of my hair that week!)

Version 4.51 is pretty old, and if you're stuck in the 4.5 version range, you should be on 4.53, which is considered extremely stable. You'll likely need to upgrade soon if you move to Windows 8/10, and the current 4.66 version is stable in production (we use it in thousands of endpoints, for daily maintenance tasks, monitoring, as well as login scripts.) Also - Kix 4.53 and higher let you tokenize your scripts, making them unreadable to curious students. \:\)

Do you have any debugging in your script to determine if Kix is running and reporting any errors? If not, my Universal Login Script has a ton of diag data and can be forced to enable debug-level logging. You can place it in your NetLogon folder, then simply configure it to run your current login script. With no real changes, you'll get quite a bit of info about what's going on when a student logs in. (My script is used in lots of schools, BTW.) Once you gather this info, you might be able to resolve the issue and go back to your simple script. Feel free to PM me if you want to give this a try.

Glenn


garyk
(Just in Town)
2016-03-17 03:40 PM
Re: Script randomly works randoly doesn't

Hey Glenn,

I will try to upgrade to 4.53 this afternoon. When I initially tested 4.66 it worked on my machine as well as my supervisor's. But for some reason I could not get it to work in the computer Lab, which is where is primarily needs to run.

Looks like the replication between the DCs is working properly. I initially though that was my problem with the 4.55 upgrade not working, but it didn't matter which DC I was hitting, sometimes it would load on if I was hitting either one of the DCs.

I currently do not have any debugging in the script. I sent you a PM, I would love to try some if you are willing to share. I am kind of wondering if the script is running properly, but random computer failing to access the print server.

Thanks

Gary


AllenAdministrator
(KiX Supporter)
2016-03-17 04:00 PM
Re: Script randomly works randoly doesn't

It is REALLY odd that you can't move from 4.5 to 4.6. Can you post your script for us to review?

garyk
(Just in Town)
2016-03-17 04:16 PM
Re: Script randomly works randoly doesn't

Sure, I looks like we have been using this script since 2006 with minor updates. Script is as follows. - Gary

 Code:
; To Prevent Breaking the Script:
;
BREAK OFF
CLS
$ret=setconsole("MINIMIZE")
;
;===============================================================================
;
; Course Critiques database
;
; sleep 30
; copy "\\nmmi.local\academic\coursecritiques\CourseCritiqueSurvey.accdb" "%userprofile%\desktop\"
;
;===============================================================================
;
; Copy ACT shortcut to desktop

sleep 30
copy "\\nmmi.local\netlogon\ACT - Method Test Prep.lnk" "%userprofile%\desktop\"
;
;===============================================================================
;
; Add printers
;
IF	SUBSTR(@WKSTA,1,5)="AALAB"
;	ADDPRINTERCONNECTION("\\po\OPAC-HP-NT-2")
;	ADDPRINTERCONNECTION("\\po\OPAC-HP-NT-3")
	ADDPRINTERCONNECTION("\\po\OPAC-TOSH-NT")
	ADDPRINTERCONNECTION("\\po\OPAC-POOL")
	SETDEFAULTPRINTER("\\po\OPAC-POOL")
ENDIF
IF	SUBSTR(@WKSTA,1,7)="APPSLAB"
	ADDPRINTERCONNECTION("\\po\APPS-HP-NT")
	SETDEFAULTPRINTER("\\po\APPS-HP-NT")
	IF INGROUP("CTM Users")
		USE T: "\\nmmi.local\academic\ctm"
	ENDIF
ENDIF
IF	SUBSTR(@WKSTA,1,6)="ARTLAB"
	ADDPRINTERCONNECTION("\\po\ARTLAB-HP-NT")
	SETDEFAULTPRINTER("\\po\ARTLAB-HP-NT")
ENDIF
IF	SUBSTR(@WKSTA,1,6)="BIOLAB"
	ADDPRINTERCONNECTION("\\po\BIO-HP-NT")
	ADDPRINTERCONNECTION("\\po\MOBILELAB-HP-NT-2")
	SETDEFAULTPRINTER("\\po\BIO-HP-NT")
ENDIF
IF	SUBSTR(@WKSTA,1,6)="CAELAB"
	ADDPRINTERCONNECTION("\\po\CAE-HP-NT")
	SETDEFAULTPRINTER("\\po\CAE-HP-NT")
ENDIF
IF	SUBSTR(@WKSTA,1,6)="ACTLAB"
	ADDPRINTERCONNECTION("\\po\OPAC-POOL")
	SETDEFAULTPRINTER("\\po\OPAC-POOL")
ENDIF
IF	SUBSTR(@WKSTA,1,6)="ENGLAB"
	ADDPRINTERCONNECTION("\\po\ENGLAB-HP-NT-1")
	ADDPRINTERCONNECTION("\\po\ENGLAB-HP-NT-2")
	SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
;Set default printer based on workstation
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB1"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB2"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB3"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB4"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB5"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB6"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB7"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB8"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,7) = "ENGLAB9"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB10"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB11"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB12"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB13"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB14"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB15"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB16"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-2")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB17"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB18"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB19"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB20"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB21"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB22"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
	IF SUBSTR(@WKSTA,1,8) = "ENGLAB23"
		SETDEFAULTPRINTER("\\po\ENGLAB-HP-NT-1")
	ENDIF
ENDIF
IF  SUBSTR(@WKSTA,1,8)="JROTCLAB"
	ADDPRINTERCONNECTION("\\po\JROTC-TOSH-NT")
	SETDEFAULTPRINTER("\\po\JROTC-TOSH-NT")
;Add and set default printer for Loaner laptops
	IF SUBSTR(@WKSTA,1,14)="LOANER-A016964"
		ADDPRINTERCONNECTION("\\po\JROTC-TOSH-NT")
		SETDEFAULTPRINTER("\\po\JROTC-TOSH-NT")
	ENDIF
	IF SUBSTR(@WKSTA,1,14)="LOANER-A016965"
		ADDPRINTERCONNECTION("\\po\JROTC-TOSH-NT")
		SETDEFAULTPRINTER("\\po\JROTC-TOSH-NT")
	ENDIF
	IF SUBSTR(@WKSTA,1,14)="LOANER-A016994"
		ADDPRINTERCONNECTION("\\po\JROTC-TOSH-NT")
		SETDEFAULTPRINTER("\\po\JROTC-TOSH-NT")
	ENDIF
	IF SUBSTR(@WKSTA,1,14)="LOANER-A017003"
		ADDPRINTERCONNECTION("\\po\JROTC-TOSH-NT")
		SETDEFAULTPRINTER("\\po\JROTC-TOSH-NT")
	ENDIF
	IF SUBSTR(@WKSTA,1,14)="LOANER-A017009"
		ADDPRINTERCONNECTION("\\po\JROTC-TOSH-NT")
		SETDEFAULTPRINTER("\\po\JROTC-TOSH-NT")
	ENDIF
ENDIF
IF	SUBSTR(@WKSTA,1,8)="LOGICLAB"
	ADDPRINTERCONNECTION("\\po\LOGICLAB-HP-NT")
	SETDEFAULTPRINTER("\\po\LOGICLAB-HP-NT")
ENDIF
IF	SUBSTR(@WKSTA,1,9)="MOBILELAB"
    ADDPRINTERCONNECTION("\\po\MOBILELAB-HP-NT-2")
	ADDPRINTERCONNECTION("\\po\MCB-HP-NT")
	ADDPRINTERCONNECTION("\\po\CHEMLAB-HP-NT")
	ADDPRINTERCONNECTION("\\po\BIO-HP-NT")
	SETDEFAULTPRINTER("\\po\MOBILELAB-HP-NT-2")
ENDIF
IF	SUBSTR(@WKSTA,1,4)="OPAC"
;	ADDPRINTERCONNECTION("\\po\OPAC-HP-NT-2")
;	ADDPRINTERCONNECTION("\\po\OPAC-HP-NT-3")
	ADDPRINTERCONNECTION("\\po\OPAC-TOSH-NT")
	ADDPRINTERCONNECTION("\\po\OPAC-POOL")
	SETDEFAULTPRINTER("\\po\OPAC-POOL")
ENDIF
IF	SUBSTR(@WKSTA,1,5)="PCLAB"
	ADDPRINTERCONNECTION("\\po\PCLAB-HP-NT-2")
	SETDEFAULTPRINTER("\\po\PCLAB-HP-NT-2")
ENDIF
IF	SUBSTR(@WKSTA,1,6)="PECLAB"
	ADDPRINTERCONNECTION("\\po\DLC-HP-NT-2")
	SETDEFAULTPRINTER("\\po\DLC-HP-NT-2")
ENDIF
IF	SUBSTR(@WKSTA,1,10)="PHYSICSLAB"
        ADDPRINTERCONNECTION("\\po\MOBILELAB-HP-NT-2")
	SETDEFAULTPRINTER("\\po\MOBILELAB-HP-NT-2")
ENDIF
IF	SUBSTR(@WKSTA,1,6)="CCCLAB"
	ADDPRINTERCONNECTION("\\po\CCCLAB-HP-NT")
	SETDEFAULTPRINTER("\\po\CCCLAB-HP-NT")
ENDIF
IF	SUBSTR(@WKSTA,1,6)="SACLAB"
	ADDPRINTERCONNECTION("\\po\SAC-DELL-NT-3")
	SETDEFAULTPRINTER("\\po\SAC-DELL-NT-3")
ENDIF
IF  SUBSTR(@WKSTA,1,10)="SCIENCELAB"
	ADDPRINTERCONNECTION("\\po\MOBILELAB-HP-NT-2")
	SETDEFAULTPRINTER("\\po\MOBILELAB-HP-NT-2")
ENDIF
IF	SUBSTR(@WKSTA,1,7)="TYPELAB"
	ADDPRINTERCONNECTION("\\po\type-hp-nt")
	SETDEFAULTPRINTER("\\po\type-hp-nt")
	IF INGROUP("CIS015_01_Tamara")
		USE Y: "\\nmmi.local\Academic\Computer Concepts\CIS015\Kinnally\Keyboarding_Sec01\" + @fullname
	ENDIF
	IF INGROUP("CIS015_02_Tamara")
		USE Y: "\\nmmi.local\Academic\Computer Concepts\CIS015\Kinnally\Keyboarding_Sec02\" + @fullname
	ENDIF
	IF INGROUP("CIS015_05_terric")
		USE Y: "\\nmmi.local\Academic\Computer Concepts\CIS015\Castillo\Keyboarding_Sec05_Castillo\" + @fullname
	ENDIF

ENDIF
IF	SUBSTR(@WKSTA,1,6)="WRTLAB"
	ADDPRINTERCONNECTION("\\po\WRTLAB-HP-NT")
	SETDEFAULTPRINTER("\\po\WRTLAB-HP-NT")
ENDIF
IF	SUBSTR(@WKSTA,1,7)="A018870"
	ADDPRINTERCONNECTION("\\po\INF-RICO-NT")
	SETDEFAULTPRINTER("\\po\INF-RICO-NT")
ENDIF
;
;
;===============================================================================
EXIT


sorry if it seems hard to read, when I post it all of my tabs are removed.


garyk
(Just in Town)
2016-03-17 04:17 PM
Re: Script randomly works randoly doesn't

my boss has his own log in script, and it worked with 4.66. I tested and was able to run 4.66 manually on my workstation as well.

Glenn BarnasAdministrator
(KiX Supporter)
2016-03-17 08:05 PM
Re: Script randomly works randoly doesn't

Gary,

I ran your code through Sanity and it reported no issues other than $Ret not being declared.

Two basic things to add - Log messages that report the start and end of the script; and results of the commands.
 Code:
$Ret = RedirectOutput('%USERPROFILE%\LSDebug.log', 1) ; create a new debug file during each logon, per user.
@DATE ' ' @TIME ' - Login script is starting.' @CRLF
; core code here...
; Sample ERROR logging - add one per mapping
@DATE ' ' @TIME ' - ' @SERROR ' when mapping printer <printer ID>' @CRLF
; script ends
@DATE ' ' @TIME ' - Login script is complete.' @CRLF
Glenn


Glenn BarnasAdministrator
(KiX Supporter)
2016-03-17 08:08 PM
Re: Script randomly works randoly doesn't

FYI - you should use the same sample error logging for drive mapping and SetDefault commands.

I have to ask - why the "Sleep 30"? seems like a long time to delay the login script.

Glenn


AllenAdministrator
(KiX Supporter)
2016-03-17 10:44 PM
Re: Script randomly works randoly doesn't

One thing that will MAJORLY decrease the time your script takes is to check if the printers are already added. Right now your script is re-adding them every time the script runs.

Checkout PrinterConnection - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=203840#Post203840
or
PriMapState - http://www.kixtart.org/forums/ubbthreads...=true#Post83313

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

Both have examples in the header of the function.


BradV
(Seasoned Scripter)
2016-03-22 10:45 AM
Re: Script randomly works randoly doesn't

Also, if each workstation is only getting matched to one if statement, your script would be faster/more efficient if you used case statements. With successive if statements, every one has to be evaluated. With select case, only tests up to the match are evaluated, the rest are ignored.