Page 1 of 1 1
Topic Options
#33940 - 2002-12-03 01:45 PM a simple one
srolland Offline
Lurker

Registered: 2002-12-03
Posts: 4
Loc: London
I'm sorry if this is really easy, but i have read websites and manuals on this script here but i can't get it to work. It's meant to copy lmhosts from NETLOGON to the users etc folder. Can you see what's wrong? (the users have admin rights).
The lmhosts is in the NETLOGON folder, it's an NT4 server with W2K clients if that makes any difference.

COPY "%0\..\lmhosts" "%WINDIR%\system32\drivers\etc\lmhosts"
_________________________
Huvvnae got a clue

Top
#33941 - 2002-12-03 01:50 PM Re: a simple one
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
place a line with:
"error:" @serror

after that one.
my quess is: access denied.
normal users have no write access to system folders.
_________________________
!

download KiXnet

Top
#33942 - 2002-12-03 01:55 PM Re: a simple one
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
Hi SRolland...

I use the LOGON.BAT to copy the hosts, lmhosts and services to the local Windows dirs. That is where the client looks for it.

Here's my batch file:
code:
 
Cls
Echo "Copying files. One moment please..."
@Echo Off

:KixDir
If not exist c:\utils\kix\*.* md c:\Utils > NUL
If not exist c:\utils\kix\*.* md c:\Utils\Kix > NUL

If (%OS%) == (Windows_NT) goto CopyNT

:Copy9X
If Exist C:\Utils\Kix\kix412.ok GoTo Logon9X
XCOPY %0\..\kix412\KIX32.EXE c:\utils\kix\ /D /H /I /R /V > NUL
XCOPY %0\..\kix412\KX16.DLL c:\utils\kix\ /D /H /I /R /V > NUL
XCOPY %0\..\kix412\KX32.DLL c:\utils\kix\ /D /H /I /R /V > NUL
XCOPY %0\..\kix412\KX95.DLL c:\utils\kix\ /D /H /I /R /V > NUL
XCOPY %0\..\kix412\KIX412.OK c:\utils\kix\ /D /H /I /R /V > NUL

:Logon9X
C:\Utils\Kix\kix32 %0\..\sLogon.kix
Goto End

:CopyNT
If Exist C:\Utils\Kix\kix412.ok GoTo LogonNT
XCOPY %LOGONSERVER%\NetLogon\kix412\KIX32.EXE c:\utils\kix\ /D /H /I /R /V > NUL
XCOPY %LOGONSERVER%\NetLogon\kix412\KIX412.OK c:\utils\kix\ /D /H /I /R /V > NUL

:LogonNT
C:\Utils\Kix\kix32 %LOGONSERVER%\NetLogon\sLogon.kix

:End
EXIT

As you can see, the batch file also takes care of different OS's.

Hope you can use it.

Greetz, Brian
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#33943 - 2002-12-03 01:59 PM Re: a simple one
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
brian, can't find the copy of the host-files in your batch.

anyway, seems that I didn't fully read the topic's starter post before replying.

anyway, placing the error line there should give you the explanation.
_________________________
!

download KiXnet

Top
#33944 - 2002-12-03 02:04 PM Re: a simple one
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
Oh... HAHAHAHAHAHA
you're totally right Lonkey.
Had a late night last night... let's keep it at that [Smile]

Anyway SRolland, I do that copy option in the LOGON.KIX.

Here's a sample of my kix script which handles that part:

code:
 
Select
Case @InWin = ("1") ;Windows NT
If Exist (@LDRIVE + "\lmhosts.")
Copy @LDRIVE + "\lmhosts." %systemroot%\system32\drivers\etc
EndIf
If Exist (@LDRIVE + "\hosts.")
Copy @LDRIVE + "\hosts." %systemroot%\system32\drivers\etc
EndIf
If Exist (@LDRIVE + "\services.")
Copy @LDRIVE + "\services." %systemroot%\system32\drivers\etc
EndIf
If Exist ("%systemroot%\system32\nbtstat.exe")
Run "%systemroot%\system32\nbtstat -R" >nul
EndIf
Case @InWin = ("2") ;Windows 9x
If Exist (@LDRIVE + "\lmhosts.")
Copy @LDRIVE + "\lmhosts." %windir%
EndIf
If Exist (@LDRIVE + "\hosts.")
Copy @LDRIVE + "\hosts." %windir%
EndIf
If Exist (@LDRIVE + "\services.")
Copy @LDRIVE + "\services." %windir%
EndIf
If Exist ("%windir%\nbtstat.exe")
Run "%windir%\nbtstat -R" >nul
EndIf
EndSelect


This should be more helpful than my last post [Smile]

Greetz, Brian
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#33945 - 2002-12-03 02:18 PM Re: a simple one
srolland Offline
Lurker

Registered: 2002-12-03
Posts: 4
Loc: London
appreciated, but i put in the error line and it didn't return an error. Does my syntax look ok?
_________________________
Huvvnae got a clue

Top
#33946 - 2002-12-03 02:22 PM Re: a simple one
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
Your line:
code:
 
COPY "%0\..\lmhosts" "%WINDIR%\system32\drivers\etc\lmhosts"

suggests a subfolder named LMHOSTS should be copied.
Try adding the dot after "lmhosts" so it looks something like this:

code:
 
COPY "%0\..\lmhosts." "%WINDIR%\system32\drivers\etc\lmhosts."

Good luck.

Brian
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#33947 - 2002-12-03 02:23 PM Re: a simple one
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
rolland, the syntax looks ok.
anyway, the line returns allways error, even if the execution was succesfull.

this makes me ask, are you sure the file runs at all?

try adding a line after that errorline with just:
get $key

it hangs the script execution until you press any key.
this way you see does it run and if it does, it will show you the error too.
_________________________
!

download KiXnet

Top
#33948 - 2002-12-03 03:31 PM Re: a simple one
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
And make sure to run it under administrative privileges.

Alternatively, search the KiXtart BBS for 'lmhost copy' since the issue of copying HOST/LMHOST files form a server to clients has been discussed numerous times. Most of the threads even contain complete code solutions!

Please take advantage of the KiXtart BBS Search!
_________________________
There are two types of vessels, submarines and targets.

Top
#33949 - 2002-12-03 03:42 PM Re: a simple one
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
SRolland...

have you read / tried my suggestions?
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

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 (mole) and 1300 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.047 seconds in which 0.019 seconds were spent on a total of 12 queries. Zlib compression enabled.

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