Page 1 of 1 1
Topic Options
#195299 - 2009-08-06 07:40 AM loading kix script via batch
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Hi all,

I have done this a several of times on several networks, but it doesn't work on a new network i'm working on.

I have created a batch file and put in the logon script field in the users in the AD.
But when i try to run it i get an error message that says "couldn't find/open logon.kix"

the code in the batch is:

 Code:
%0\..\kix32.exe \\[server name]\netlogon\logon.kix


whats wrong here?

Top
#195300 - 2009-08-06 08:34 AM Re: loading kix script via batch [Re: ddady]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
How about:
 Code:
%LOGONSERVER%\NETLOGON\kix32.exe %LOGONSERVER%\NETLOGON\logon.kix

Top
#195304 - 2009-08-06 10:40 AM Re: loading kix script via batch [Re: Arend_]
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Without the double "\\" before the %logonserver% ?

I'll try it and post again for success or failure

Top
#195306 - 2009-08-06 11:10 AM Re: loading kix script via batch [Re: ddady]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
 Originally Posted By: ddady
Without the double "\\" before the %logonserver% ?
....


Yes. %logonserver% has \\servername as its value so the extra \\ is not needed.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#195309 - 2009-08-06 12:06 PM Re: loading kix script via batch [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Using a specific server name in the path is not recommended, because it places all the load and responsibility on that server. Using %LOGONSERVER% in that form is questionable, as it isn't in my environment set to confirm the slashes are present (although the LOGON environment is different from the RUNNING environment). See this page for standard environment variable definitions. Unfortunately, it doesn't clarify the format.

The proper method is to use
 Code:
\\DOMAIN\NETLOGON\kix32.exe \\DOMAIN\NETLOGON\logon.kix
which will connect to the first responding DC. This is usually the same as the logon server, but a more flexible method. Note that "DOMAIN" is your local domain name. You could use %USERDOMAIN% instead of DOMAIN if you wish.

Glenn


_________________________
Actually I am a Rocket Scientist! \:D

Top
#195311 - 2009-08-06 12:16 PM Re: loading kix script via batch [Re: Glenn Barnas]
NaasMarais Offline
Fresh Scripter

Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
I use the following in my bat file so that it can access the kix scripts

@ECHO OFF

%0\..\kix32 %0\..\default.kix
Hope it helps
_________________________
KIX Scripting is the Bomb!!

Top
#195312 - 2009-08-06 01:08 PM Re: loading kix script via batch [Re: Glenn Barnas]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
 Originally Posted By: Glenn Barnas
Using a specific server name in the path is not recommended, because it places all the load and responsibility on that server. Using %LOGONSERVER% in that form is questionable, as it isn't in my environment set to confirm the slashes are present (although the LOGON environment is different from the RUNNING environment). See this page for standard environment variable definitions. Unfortunately, it doesn't clarify the format.

The proper method is to use
 Code:
\\DOMAIN\NETLOGON\kix32.exe \\DOMAIN\NETLOGON\logon.kix
which will connect to the first responding DC. This is usually the same as the logon server, but a more flexible method. Note that "DOMAIN" is your local domain name. You could use %USERDOMAIN% instead of DOMAIN if you wish.

Glenn



Then again, DFS on 2000 Domains is less stable then using Sharenames on servers, and is prone to errors in the DFS system, DNS system et all. besides that %LOGONSERVER% is the server that answered the quickest. So load balancing is always in place. %LOGONSERVER% will always point to an Active server so %LOGONSERVER% is best practice in my opinion.

Anyway this is just discussing Proper use. Has nothing to do with the original problem ;-)

Top
#195314 - 2009-08-06 01:44 PM Re: loading kix script via batch [Re: NaasMarais]
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
 Originally Posted By: NaasMarais
I use the following in my bat file so that it can access the kix scripts

@ECHO OFF

%0\..\kix32 %0\..\default.kix
Hope it helps



Well, this method solved the problem. Thanks NaasMarais :-)

And ofcourse thanks to Glen and apronk

Top
#195316 - 2009-08-06 02:00 PM Re: loading kix script via batch [Re: ddady]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Great that it solved the problem but it is very very very old school (NT4).

The options Arend and Glenn posted should both also do the trick and are way more up to date. My personal preference (and what I tell people when they ask) would be wath Glenn suggested.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#195320 - 2009-08-06 03:44 PM Re: loading kix script via batch [Re: Mart]
ddady Offline
Getting the hang of it

Registered: 2006-09-03
Posts: 98
Frankly i prefer to use the %SERVERLOGON% or the DOMAIN methods, but unfortunately they dont workm in my case. I'm using a SERVER 2003 with XP PRO.

Like i said in the begining, i have tried it with the server name as i used it before in other networks and it worked, but from some reason over here now it doesn't.

If anyone knows why and how to fix it, i will be more than glad to do it.

Top
#196645 - 2009-11-11 09:15 AM Re: loading kix script via batch [Re: ddady]
Christof Offline
Fresh Scripter

Registered: 2003-04-10
Posts: 33
Loc: Ornbau, Frankonia, Germany
%SERVERLOGON% can not work, because the name of the variable is %LOGONSERVER%.

Now I changed my script and I call it this way:

\\%USERDOMAIN%\NETLOGON\wkix32.exe \\%USERDOMAIN%\NETLOGON\logon.kix

It works fine, but I read, that if wkix is used, it should be started this way:

start /w /b \\%USERDOMAIN%\NETLOGON\wkix32.exe \\%USERDOMAIN%\NETLOGON\logon.kix

What do you think about that and what should be used? wkix32 or kix32?

Top
#196647 - 2009-11-11 12:06 PM Re: loading kix script via batch [Re: Christof]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
wkix32.exe is functionally identical to kix32.exe except that it does not create a default console aka "DOS box" when it launches.

wkix32 is used for silent scripting when you don't want an ugly empty black window to pop up. wkix32 may still create a console under certain conditions.

The /B switch tells CMD.EXE not to start a new console, so serves a similar purpose.

The /W is (I assume) a synonym for /WAIT, and it tells CMD.EXE to wait for the command to complete. It's useful for commands that detach from the process that started them.

In this case if it is working as you expect then you don't need "START /W /B"

Top
#196649 - 2009-11-11 05:58 PM Re: loading kix script via batch [Re: Richard H.]
Christof Offline
Fresh Scripter

Registered: 2003-04-10
Posts: 33
Loc: Ornbau, Frankonia, Germany
Ok, thank you. I read in the Docu that wkix don't create a box, but in my evironment it creates a box, so I never understood the differnce between these two.

Do you know, in which conditions it still creates a box?

Top
#196665 - 2009-11-12 09:09 AM Re: loading kix script via batch [Re: Christof]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
If you create screen output then a command window will pop up.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#196668 - 2009-11-12 09:49 AM Re: loading kix script via batch [Re: Mart]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Originally Posted By: Mart
If you create screen output then a command window will pop up.


What Mart said.

Look for unhandled values returned from functions (zeros and ones on the screen)

Top
#196692 - 2009-11-13 04:35 PM Re: loading kix script via batch [Re: ddady]
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 309
Loc: STRASBOURG, France
here is my cmd file :
 Code:
@echo off
 
setlocal
set scriptdir=%~dp0
set scriptname=%~n0
 
"%scriptdir%kix32.exe" "%scripdir%%scriptname%.kix
 
endlocal


scriptdir contains the full path of the .cmd file
scriptname constains the cmd file without extension.

So in the directory, i have logon.cmd, logon.kix and kix32.exe
If i have to test a new version, i can copy the files anywhere.
All path are relative to the path of the logon.cmd file \:\)

This has been working since NT4
_________________________
Christophe

Top
Page 1 of 1 1


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

Who's Online
0 registered and 262 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.065 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

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