Page 1 of 1 1
Topic Options
#186338 - 2008-03-18 02:41 PM script window does not close
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
hey ppl, I just started a new job as network admin for a school district and the person I replaced used Kix scripts which I never used but would like to start using. Anyway, everytime a user logs on to their workstation a script window pops up with some code but the windows stays open. How do I configure that script to run but close when it's done? thanks
Top
#186339 - 2008-03-18 02:56 PM Re: script window does not close [Re: techie211]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Did this always happen or did you make some changes in the script before this started happening? What OS are the clients using?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186340 - 2008-03-18 03:01 PM Re: script window does not close [Re: Mart]
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
I didn't make any changes.it always happened. they are running a mix of Win2k pro/WinXP Pro
Top
#186341 - 2008-03-18 03:06 PM Re: script window does not close [Re: techie211]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Ok. Can you show us the code?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186342 - 2008-03-18 03:12 PM Re: script window does not close [Re: Mart]
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
Sure...

********************************************
IF INGROUP("oracle")
use o: "\\porcl\oracle"
endif
if ingroup("hs622_printers")
shell "con2prt /c \\srvprn01\hs622hp4"
shell "con2prt /cd \\srvprn01\hs622lj4000"
endif
********************************************

Top
#186343 - 2008-03-18 03:35 PM Re: script window does not close [Re: techie211]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Con2Prt, didn't see that one for a long time
Kix has this functionality build in so there is actually no need for an external app to connect printers and/or set a printer as the default printer.
Beware that the first function requires the printers share name and the second requires the printer name. Keeping the share name and the printer name the same on your printer server would be best practice in my book.

 Code:
If InGroup("oracle")
	Use o: "\\porcl\oracle"
EndIf
If InGroup("hs622_printers")
	$rc = AddPrinterConnection("\\server\printersharename)
	$rc =SetDefaultPrinter("\\server\printername")
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186344 - 2008-03-18 04:00 PM Re: script window does not close [Re: Mart]
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
does this look correct? so this script will run and close it's self out so the windows disappears after making those connections?

If InGroup("oracle")
Use o: "\\porcl\oracle"

Endif
If InGroup("hs622_printers")
$rc = AddPrinterConnection("\\srvprn01\hs622hp4")
$rc = AddPrinterConnection("\\srvprn01\hs622lj4000")
$rc = SetDefaultPrinter("\\srvprn01\hs622lj4000")

EndIf

Top
#186345 - 2008-03-18 04:36 PM Re: script window does not close [Re: techie211]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
If this is the entire script then the scrip[t window should close when it's done. You could add some error checking by looking at the contents of $rc. Anything other then 0 will indicate some kind of error.

Two comments.
-1 Deleting the O: drive before mapping it would ensure you that the correct share is mapped to the O drive. See the code below.
-2 Please use the code tags when posting code. If you put [ code ] above the code and [ /code ] below it (without the spaces) the formatting gets preserved.

 Code:
If InGroup("oracle")
	Use o: /delete /persistent
	Use o: "\\porcl\oracle"
EndIf

If InGroup("hs622_printers")
	$rc = AddPrinterConnection("\\srvprn01\hs622hp4")
	$rc = AddPrinterConnection("\\srvprn01\hs622lj4000")
	$rc = SetDefaultPrinter("\\srvprn01\hs622lj4000")
EndIf


Edited by Mart (2008-03-18 04:38 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186346 - 2008-03-18 04:43 PM Re: script window does not close [Re: Mart]
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
thanks for all your help. sorry for not using the tags. will remember for the next time.

-t

Top
#186347 - 2008-03-18 05:42 PM Re: script window does not close [Re: techie211]
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
did not work. window did not close. How does this work? In my user profile I have a 'logon.bat' file to run once I logon to the network. I tried to search for the logon.bat and found it listed in different folders(see pic).
Here is the code int the 'logon.bat' file that calls the 'kix.txt' which is the script window that stays open.

 Code:
IF "%OS%" == "Windows_NT" goto Hide_Box
IF "%OS%" == "Windows 2000" goto Hide_Box
IF "%OS%" == "Windows XP" goto Hide_Box
@start /w  %0\..\kix32 kix.txt
goto exit
:Hide_Box
@start /w  /b %0\..\kix32 kix.txt
exit


Attachments
logonbat-2.jpg (573 downloads)
Description:



Top
#186349 - 2008-03-18 06:14 PM Re: script window does not close [Re: techie211]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
The bat(ch) file should be in the sysvol/netlogon folder on each domain controller. All others you found do nothing at logon unless they are called upon by the login script or by some other app that might run at logon.

It could also be the bat(ch) file console window that stays open. What happens if you run the command below from a command prompt (I assume you are using Win2K or up and AD)? This way you will see if it is the kix console window or the batch console window that stays open. If all windows close then the console windows is the one screwing things up.
You could do without the batch file and call your kix script directly if there are no Win9x and/or WinNT4 clients left on the network.

 Code:
kix32.exe pathtoyourscript\script.kix (could also be .scr, .txt or whatever)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186351 - 2008-03-18 07:05 PM Re: script window does not close [Re: Mart]
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
I ran that command but nothing happened.??? no errors just back to the command prompt.
 Quote:
You could do without the batch file and call your kix script directly if there are no Win9x and/or WinNT4 clients left on the network


we do not have any WinNT/Win9x clients so I would like to know how this is done.

Top
#186352 - 2008-03-18 08:05 PM Re: script window does not close [Re: techie211]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
So if you open a command window, go to the drive and folder where kix32.exe is located and run kix32 pathtothescript\scriptname.kix nothing happens? The script is not executed?

I made a few changes to the script I posted earlier. I added some error checking and debugging messages. Please give this one a g and lets us know what you see on the screen. Do not run this from a batch file but run it directly from the command window.

 Code:
?"checking if the user is part of the oracle group."
If InGroup("oracle")
	?"The user is part of the oracle group."
	?"Start mapping the O drive."
	Use o: /delete /persistent
	Use o: "\\porcl\oracle"
Else
	?"The user is not a memeber of the oracle group."
EndIf

?"checking if the user is part of the hs622_printers group."
If InGroup("hs622_printers")
	?"The user is a member of the hs622_printers group."
	?"Start adding printers."
	$rc = AddPrinterConnection("\\srvprn01\hs622hp4")
	If $rc <> "0"
		?"There was an error adding the hs622hp4 printer."
		?"Error: " $rc
	Else
		?"Printer hs622hp4 succesfully added."
	EndIf
	$rc = AddPrinterConnection("\\srvprn01\hs622lj4000")
	If $rc <> "0"
		?"There was an error adding the hs622lj4000 printer."
		?"Error: " $rc
	Else
		?"Printer hs622lj4000 succesfully added."
	EndIf
	$rc = SetDefaultPrinter("\\srvprn01\hs622lj4000")
	If $rc <> "0"
		?"There was an error setting the hs622lj4000 printer as default printer."
		?"Error: " $rc
	Else
		?"Printer hs622lj4000 succesfully set as default."
	EndIf
Else
	?"The user is not a member of the hs622_printers group."
EndIf

Sleep 10


To run the script without any batch files you do set the logon script in a group policy. But maybe we should solve the problem your are having first before trying new stuff.

In the script name field type the following:
\\YOURDOMAiNNAME\SYSVOL\YOURDOMAINNAME\Scripts\wkix32.exe

In the script parameter field type the following:
\\YOURDOMAINNAME\SYSVOL\YOURDOMIANNAME\Scripts\yourscrupt.kix
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186353 - 2008-03-18 08:24 PM Re: script window does not close [Re: Mart]
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
these are the results

 Quote:
checking if the user is part of the oracle group.
The user is part of the oracle group.
Start mapping the O drive.
checking if the user is part of the hs622_printers group.
The user is not a member of the hs622_printers group.

Top
#186355 - 2008-03-18 08:59 PM Re: script window does not close [Re: techie211]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Looks good. If the window did not stay open after the script finished beside for the 10 extra seconds that the Sleep 10 does then the batch file is the culprit.
You could run the script from a batch file like shown below. If you have nothing else then Win2K, Win2K3 or WinXP or up then there is really no need for all the stuff that is in the batch file you posted. Only thing you need to do is change YOURDOMAINNAME to the actual domain name and change the name of the script to the actual name of the script. Also you should be sure that kix32 and/or wkix32 and the script are in the proper folder. If not move them or alter the path in the batch file below.

 Code:
\\YOURDOMAINNAME\SYSVOL\YOURDOMAINNAME\Scripts\kix32.exe \\YOURDOMAINNAME\SYSVOL\YOURDOMAINNAME\Scripts\yourscript.kix
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186357 - 2008-03-19 01:00 AM Re: script window does not close [Re: Mart]
techie211 Offline
Fresh Scripter

Registered: 2008-03-17
Posts: 9
when I ran kix32.exe to run the last script you posted I got the output I posted in the command window but again no window popped up. As for your last post, were does this code-->
 Code:
\\YOURDOMAINNAME\SYSVOL\YOURDOMAINNAME\Scripts\kix32.exe \\YOURDOMAINNAME\SYSVOL\YOURDOMAINNAME\Scripts\yourscript.kix
go?
do I put it into a .bat file? or in a policy like you explained earlier?

Top
#186361 - 2008-03-19 09:28 AM Re: script window does not close [Re: techie211]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You can put it in your batch file or in a GPO as explained above. If you put it in a GPO you need to remove the old logon script from the user's profile otherwise the script will run twice.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#186378 - 2008-03-19 05:31 PM Re: script window does not close [Re: Mart]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
If you use a legacy user logon script and if the workstations are all Windows NT (or 2000, XP, Vista), IMHO it is better to use something like
 Code:
wkix32 kixtart.kix

in the logon batch file. No full path needed!

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
1 registered (Allen) and 781 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.116 seconds in which 0.085 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