Page 1 of 2 12>
Topic Options
#173162 - 2007-01-24 08:00 PM How to for changing from Batch to Kix login on NT Domains?
GimpyWarpig Offline
Fresh Scripter

Registered: 2007-01-23
Posts: 6
Loc: Ohio
Is there a How-to for starters on converting my 5+ year old BAT login script over to Kix? I've noticed several times people have advised to stop using simple batch and start using KIX for login scripts.
_________________________
.

Top
#173163 - 2007-01-24 08:17 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: GimpyWarpig]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Hello Gimpy and welcome to the board. Not to be a spoil sport but a 90K image is a bit large to have for a sig that will get downloaded by hundreds of clients potentially - i.e. it adds no real value but does increase the server bandwidth usage.

Okay, well there is not HOW TO GUIDE for changing over as it depends on what is used in the batch and how

Using the CODE TAGS please post your batch file here and I'm sure that someone can give you good advice on converting it over.

Thanks

Top
#173164 - 2007-01-24 08:37 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: NTDOC]
GimpyWarpig Offline
Fresh Scripter

Registered: 2007-01-23
Posts: 6
Loc: Ohio
No problem on the sig.

The reason I came here was to research how to properly call an exe file and after reading a good bit over a couple days I've become overwhelmed with the amount of information available here. What I've noticed is quite a few people recommend to drop Batch altogether and use KIX directly.

Here's the login batch in it's current incarnation:
Code:
@echo off
REM DRIVE MAPPING
	@echo off
	Echo .
	Echo Login Script Starting...
	Echo .
	net time \\dc001 /set /yes
	net use s: /delete
	net use p: /delete
	net use x: /delete
	net use l: /delete
REM	Cleanup
	net use p: \\FS001\programs
	net use s: \\FS001\shared
	net use l: \\ap002\application
	net use x: \\fs001\ENG_DATA
	net use u: /home


REM The next line calls softbatline.bat which scans registry for registered programs & saves
REM the info to %computername%.sts (software tracking pickup)
REM Softbatline.bat must be in a writable directory because it creates temporary file
	call l:\heohsoft\softbatline.bat > l:\HEOHSOFT\%COMPUTERNAME%.stp


REM this removed 011403	copy s:\software\fonts\ht*.* c:\winnt\fonts /y
	copy L:\HEOHSOFT\font\system.ttf c:\winnt\fonts /y

REM	call kix32.exe disclaim.kix
	Kix32 "\\dc001\netlogon\disclaim.kix"
        kix32 "\\dc001\netlogon\IE\W2W.scr"
	
If "%OS%" == "Windows_NT" goto EOF

:CHECKRAS95
	@echo off
	echo .
	Echo Checking for Remote Connection
	echo .
	z:
	rem following line should be "call z:\rtv95_98.bat ..etc"
	call z:\rtv95_98.bat "remote connection" HKLM\SYSTEM\CurrentControlSet\services\remoteaccess RCONNECTION
	IF NOT "%RCONNECTION%" == "KEY_NOT_FOUND" GOTO EOF
	echo RAS Connection not detected....
	goto runscript
:ENDCHECKRAS95

REM  Tasks to run if not connected via RAS and win9x pc
:RUNSCRIPT
	echo .
	echo .
	echo .
goto EOF
:ENDSCRIPT

:EOF
	REM This is needed to let the login script finish
	c:


I also need to add to the script a call to "sceumloginagent.exe" which is a new username resolution agent on ver 5.5 of Surfcontrol WebFilter. There is a eumlogin.ini file which I'm assuming needs to be present in the same folder as the sceumloginagent.exe file as well.

Any help is appreciated.
_________________________
.

Top
#173166 - 2007-01-24 09:57 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: GimpyWarpig]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
What version of KiXtart are you using or going to use ?

I would recommend using version 4.53 since you're new at it and don't have to worry about testing old scripts.

Next would be do you really want to show the users what's going on or use WKIX32.EXE silently so users don't even know what's going on?

I recommend the silent approach, but it's up to you.

What is your Server / Domain structure ? NT4 or AD ? NT4/2000/2003 ?

.

Top
#173167 - 2007-01-24 10:03 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: NTDOC]
GimpyWarpig Offline
Fresh Scripter

Registered: 2007-01-23
Posts: 6
Loc: Ohio
Doc,

I'm using ver 4.5.1 currently. Agreed, Silent is best. And the domain structure is AD 2000 Native. All clients are w2k pro or xp pro.

I've been spending more time this afternoon reading and trying to get up to speed - the more I read the more I realize how much I need to learn!

Thanks,
Gimpy
_________________________
.

Top
#173168 - 2007-01-24 10:33 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: GimpyWarpig]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well I would really go with 4.53 (many fixes including file move/del/etc...)

Code:
If Not @LogonMode
  Break On
Else
  Break Off
EndIf
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
$SO=SetOption('WrapAtEOL','On')

;Active Directory manages the time NET TIME is old NT4 days
	;net time \\dc001 /set /yes

;You're not even checking if these drives are mapped and not sure why
;Admins map/unmap each logon but that's okay.  
;One of the great things of KiXtart is mapping a drive based on Group Membership
;Example:  If InGroup(@Domain+'\Finance') USE P: "\\FS001\Finance" EndIf
	USE S: /DELETE /PERSISTENT
	USE P: /DELETE /PERSISTENT
	USE X: /DELETE /PERSISTENT
	USE L: /DELETE /PERSISTENT
;A semi-colon is like a REM from batch	Cleanup
    USE P: '\\FS001\programs'
	USE S: '\\FS001\shared'
	USE L: '\\ap002\application'
	USE X: '\\FS001\ENG_DATA'
	USE W: @HomeDir

;REM The next line calls softbatline.bat which scans registry for registered programs & saves
;REM the info to %computername%.sts (software tracking pickup)
;REM Softbatline.bat must be in a writable directory because it creates temporary file

;What are the contents of softbatline.bat ?  I'm sure we can rewrite it into KiXtart
;	call l:\heohsoft\softbatline.bat > l:\HEOHSOFT\%COMPUTERNAME%.stp


;REM this removed 011403	copy s:\software\fonts\ht*.* c:\winnt\fonts /y

;This line should fail for normal users.  Normal users can not install fonts and the path
;would be wrong for many computers.
;	copy L:\HEOHSOFT\font\system.ttf c:\winnt\fonts /y
;Untested but something like this but again you wouldn't want to do this every
;login either as it's a waste of time and should produce an error of sorts.
COPY '\\HEOHSOFT\font\system.ttf' '%WINDIR%\FONTS'

;Running all from WKIX32.EXE we don't need this method just place all the code
;into this script.  No need to use different extensions either.  I would use .kix
;REM	call kix32.exe disclaim.kix
;	Kix32 "\\dc001\netlogon\disclaim.kix"
;        kix32 "\\dc001\netlogon\IE\W2W.scr"

CALL @LDrive+'disclaim.kix'
CALL @LDrive+'IE\W2W.scr'
	
;No need for this stuff as you don't have Windows 9x anymore.
;Would need to think more about what you're wanting to do if someone
;is remoted in via RAS or VPN 

;If "%OS%" == "Windows_NT" goto EOF

;:CHECKRAS95
;	@echo off
;	echo .
;	Echo Checking for Remote Connection
;	echo .
;	z:
;	rem following line should be "call z:\rtv95_98.bat ..etc"
;	call z:\rtv95_98.bat "remote connection" HKLM\SYSTEM\CurrentControlSet\services\remoteaccess RCONNECTION
;	IF NOT "%RCONNECTION%" == "KEY_NOT_FOUND" GOTO EOF
;	echo RAS Connection not detected....
;	goto runscript
;:ENDCHECKRAS95
;
;REM  Tasks to run if not connected via RAS and win9x pc
;:RUNSCRIPT
;	echo .
;	echo .
;	echo .
;goto EOF
;:ENDSCRIPT
;
;:EOF
;	REM This is needed to let the login script finish
;	c:


.

Top
#173169 - 2007-01-24 11:08 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: NTDOC]
GimpyWarpig Offline
Fresh Scripter

Registered: 2007-01-23
Posts: 6
Loc: Ohio
Oh my... Many questions come to mind!

First off, thank you for taking time out of your day to answer this n00by's questions!


Regarding 4.5.3 - Changing to that version is as simple as replacing the 4.5.1 version of kix32.exe with the newer version, right?

Awesome idea on the group membership drive mappings, I will certainly look at doing that.

Fonts copy line I will remove. It is no longer needed, and hasnt been for quite some time.

The lines you put here:
CALL @LDrive+'disclaim.kix'
CALL @LDrive+'IE\W2W.scr'

Is @LDrive+ a constant variable signifying the netlogon directory?


Here is the softlinebat.bat code. (*disclaimor, this was not my work. A coworker wrote it and asked me to use it on login to help him get a software inventory. His intent is to query the registry for installed applications and save the results in a text file which he imports into an access DB.)

Code:
@echo off
REGEDIT /E  %COMPUTERNAME%A.txt "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\Uninstall"
Find "DisplayName" < %COMPUTERNAME%A.txt | Find /V "QuietDisplayName" > %COMPUTERNAME%B.txt
FOR /F "tokens=1,2 delims==" %%A IN (%COMPUTERNAME%B.txt) do @echo %%~B
DEL %COMPUTERNAME%A.txt
DEL %COMPUTERNAME%B.txt



Doc, in the end all I need the script to do (currently - I'm excited to be learning more and will be adding cool stuff as I learn it for sure) is map some drives, and execute the softline.bat, disclaim.kix, w2w.scr, and SCEUMLoginAgent.exe.

The w2w.scr is a corporate mandated piece which launches IE to the corporate homepage on the first logon per day.

Disclaim.kix is a disclaimor regarding Computer Usage.
_________________________
.

Top
#173170 - 2007-01-24 11:16 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: NTDOC]
GimpyWarpig Offline
Fresh Scripter

Registered: 2007-01-23
Posts: 6
Loc: Ohio
I just realized how silly some of my questions are - obviously using 4.5.3 is as simple as copying the newer version to the right folder. Taking a deep breath and looking again throughout the user manual now. LOL.
_________________________
.

Top
#173172 - 2007-01-25 01:26 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: GimpyWarpig]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
While Doc is sorting out your code, I'd like to make a couple of suggestions too:

1. The disclaim.kix and w2w.scr could be just incorporated into your main script too, totally avoiding the calls. This is a purely a preference on your part if you want to do it that way though.

2. While you are learning, you might also do yourself a favor and look through all the pre-made User Defined Functions (UDFs). I can promise you the time spent there looking through them will make you realize how much more stuff you can be doing in your script, and the best part... someone else has already done the hard work. See them here:
http://www.kixtart.org/UDF

3. Your bat file can be replaced with kix code. Unfortunately I don't have time to throw the code together for you, but ArrayEnumKey and ArrayEnumValue will do most of the work for you. I would also bet there are a number of examples on the board for software inventories etc.

Top
#173173 - 2007-01-25 01:57 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: GimpyWarpig]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Gimpy,

You can try the pre-made login script from my site. Put the kixtart.kix, login.ini, and kix32.exe in your netlogon share (after customizing the INI file, of course) and you're done.

I recently inherited an environment with 329 .KIX files, 14 .REG files, and 12 .VBS scripts that comprised the "login script" and now have one script & one config file to handle all the logic. Talk about scary!

Using this script/config file, you can pretty much reduce your login script configuration to:
Code:
[PROGSHARE]
CLASS=DISK
TARGET=P:
PATH=\\FS001\programs
GROUPS=
OUS=
# repeat this for each mapping, defining groups and/or OUs
# to control who gets the mapping

# This resource record reports the mapping, but actually doesn't map 
# anything, since this happens automatically in AD domains
[HOMESHARE]
CLASS=DISK
TARGET=H:
PATH=HOME


# display a disclaimer, Message Of The Day, or some important notice
# (up to 10 allowed)
# domain admins don't get this message :)
[DISCLAIM]
CLASS=MESSAGE
PATH=disclaim.txt
GROUPS=!Domain Admins

# Call a script to display the disclaimer AND ask for acknowlegement
# Only domain admins - discourages logging in with that much power ;)
[ADMIN_DISCLAIM]
CLASS=SCRIPT
PATH=disclaim.kix
METHOD=call
GROUPS=Domain Admins

Just shows an example of how to think of your login needs as a collection of resources instead of lots of IF statements and hard-coded logic. The configuration is fully documented in the ZIP package.

Short of enhancements due to NT4 => W2K => W2K3 and the growth of kixtart's capabilities, the core logic in this login script has changed very little from when I first wrote it in 1996. (yeah, that's 11 years ago!)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#173174 - 2007-01-25 02:08 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: Glenn Barnas]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Since you are starting from scratch, may I suggest you NOT use the .SCR extension ... to my mind its been deprecated and it really confuses the heck out people.
Top
#173175 - 2007-01-25 02:12 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: Shawn]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Originally Posted By: NTDOC
;Running all from WKIX32.EXE we don't need this method just place all the code
;into this script. No need to use different extensions either. I would use .kix



Think we're on the same page Shawn

Top
#173176 - 2007-01-25 02:14 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: GimpyWarpig]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Everyone keeps mentioning KIX32.EXE but if you want it to go silently you need to use WKIX32.EXE (well you could hide KIX32.EXE with some policies maybe but WKIX32.EXE is designed to be silently used)

Just place WKIX32.EXE in the netlogon folder and use it


WKIX32.EXE LOGIN.KIX

Top
#173178 - 2007-01-25 02:23 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Well, it doesn't pay to configure disclaimer text in a login script if the script runs hidden or minimized, now does it?

My script runs visible, but processes about 30 resource records to complete between 7 and 12 mappings in about 4-5 seconds in our network. The disclaimer is short - 3 lines - and delays the processing by only 2 seconds (although this can be controlled in the resource record). I did this because a GAO auditor I worked with in the past said the disclaimer had to be plainly visible to hold up in court. When I asked about the delay of only 2 seconds, he replied "visible does not always mean readable".

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#173179 - 2007-01-25 02:31 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Originally Posted By: Glenn Barnas
Well, it doesn't pay to configure disclaimer text in a login script if the script runs hidden or minimized, now does it?



Sure it does. Just because you don't see the other messages. If you output a MessageBox or Open a Web page or anything that outputs to screen it can still be seen. It's just that WKIX32.EXE by default won't show any processing unless there is something to show.

Top
#173181 - 2007-01-25 03:47 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
I was referring more to the default policy settings for Run Login Scripts Minimized and such.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#173183 - 2007-01-25 05:59 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
I used to show the login script with KIX32.EXE but once I converted the login script to be silent it actually works out better now. I can actually run longer running scripts without most people even knowing they're running if I need to do inventory or some other long running task.

.

Top
#173185 - 2007-01-25 09:03 AM Re: How to for changing from Batch to Kix login on NT Domains? [Re: NTDOC]
Phoenix1987 Offline
Fresh Scripter

Registered: 2007-01-02
Posts: 49
Loc: Rotterdam, Netherlands
Question:

i use the WKIX32.exe why ? i dont know sounds better :P.
But it isnt an silent script. it also shouldnt but like you say here is should run silent.
whats up with that ?
_________________________
A mistake is Human, But to make it a real mess you need a computer.

Top
#173192 - 2007-01-25 12:04 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: Phoenix1987]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Unless you have something wrong in your code or you launch it with a batch file it is silent.

Do you call it with a batch file? If so don't do it that way.

Post your full code here and maybe we can tell you why it's not silent.

Top
#173194 - 2007-01-25 12:19 PM Re: How to for changing from Batch to Kix login on NT Domains? [Re: NTDOC]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
In my office the logon script also deploys patches and applications, in addition to mapping drives and such, the users have gotten used to allowing the script to finish before running any apps

I compliled the computer use agreement kixforms gui into an iexpress exe package which I call from the script. It is sent to top and the script runs behind it, so very often the users do not even see the script window running
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 1263 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.184 seconds in which 0.135 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