Page 1 of 1 1
Topic Options
#199711 - 2010-09-01 03:46 PM .bat file runs on my PC but not through kix login script
pink_stig Offline
Fresh Scripter

Registered: 2010-09-01
Posts: 10
Loc: Lincoln
Hi guys,

I was wondering if you could help me... We currently use kix login scripts in our network and I am trying to delete some files on each machine when the users login. To do this I have created a .bat file that works perfectly on my machine. But, when I run it from the kix login it doesnt find the locations.

The code to call the .bat file is

IF INGROUP("ETC ETC ETC")
RUN '\\SERVER\NETLOGON\test.bat'
ENDIF

exit

This then runs the .bet file fine....

The .bat file is made up of this

Echo off
Cls
:menu
echo.
echo.................
echo Deleting ACAD Virus Files
echo.................
echo.
DEL /F /S /Q "acad.dvb"
DEL /F /S /Q "acaddoc.lsp"
DEL /F /S /Q "acadapq.lsp"
exit

It runs ok, but then says cannot find c:/Windows/R - and there is no reference to this folder in the script anywhere.

Can you help me????

Top
#199712 - 2010-09-01 04:24 PM Re: .bat file runs on my PC but not through kix login script [Re: pink_stig]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Try this:
 Code:
If InGroup("ETC ETC ETC")
   go C:
   Shell '"'+%COMSPEC%+'" /C \\SERVER\NETLOGON\test.bat'
EndIf

Top
#199713 - 2010-09-01 04:29 PM Re: .bat file runs on my PC but not through kix login script [Re: pink_stig]
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 311
Loc: STRASBOURG, France
1) may be should you code a full path in your bat file.
 Code:
DEL /F /S /Q "C:\acad.dvb"
DEL /F /S /Q "C:\acaddoc.lsp"
DEL /F /S /Q "C:\acadapq.lsp"


2) in explorer, when you show an UNC path and the double-click on a .bat file, you always have a message that says it is impossible to set the current directory to an UNC path (in this case, default dir is %systemroot%). This doesn't not happen when the bat file is on a mapped drive.

if you run a bat file from the netlogon within a kix script, you can try something like that :
 Code:
SHELL 'start "my title" /D "%temp%" cmd /C "\\SERVER\NETLOGON\test.bat"'


start is a command line command to execute a command without waiting for process end
"my title" is the windows title
/D "%temp%" is the default dir for the process. In this case, cmd can use %temp% as default dir !!!
_________________________
Christophe

Top
#199715 - 2010-09-01 05:54 PM Re: .bat file runs on my PC but not through kix login script [Re: ChristopheM]
pink_stig Offline
Fresh Scripter

Registered: 2010-09-01
Posts: 10
Loc: Lincoln
Wow, thanks for a quick response guys!!!

I have amended the kix file to

If InGroup("ETC ETC ETC")
go C:
Shell '"'+%COMSPEC%+'" /C \\SERVER\NETLOGON\test.bat'
EndIf

As suggested and it works a treat... and also changed the .bat file to

DEL /F /S /Q "C:\acad.dvb"
DEL /F /S /Q "C:\acaddoc.lsp"
DEL /F /S /Q "C:\acadapq.lsp"

I have moved lots of files in different locations on the c: and it gets rid of all of them!!!

Thanks so much! recon I'll roll this out for tomorrow to start the cleanup process of the CAD virus... friggin thing.

Thanks again!

Top
#199727 - 2010-09-02 11:41 AM Re: .bat file runs on my PC but not through kix login script [Re: pink_stig]
pink_stig Offline
Fresh Scripter

Registered: 2010-09-01
Posts: 10
Loc: Lincoln
Hey, just so you know, all went great with the script and its now been rolled out.

thanks again for all your help!

Top
#199730 - 2010-09-02 01:17 PM Re: .bat file runs on my PC but not through kix login script [Re: pink_stig]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
Just an aside, but why don't you just delete the files from withing kix?
Top
#199731 - 2010-09-02 01:24 PM Re: .bat file runs on my PC but not through kix login script [Re: pink_stig]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Originally Posted By: pink_stig
Hey, just so you know, all went great with the script and its now been rolled out.

thanks again for all your help!


You're welcome, have +1 Karma for taking the time to follow up and let us know.

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 320 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.054 seconds in which 0.023 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