#30033 - 2002-10-01 09:07 PM
Trouble with LMHOSTS
|
Tony72
Getting the hang of it
Registered: 2002-06-18
Posts: 53
|
Where I work we are having a lot of problems with Netbios name resolution. I personally believe that there are issues with the switches (we didnt have these problems before they went in), but since we outsource the hubs/routers/switches, I cant fix it and the people managing it havent done anything. But I digress.
My problems seem to be, for the most part, with WinNT OSs (NT/2k). I tried using the Kixtart "copy" command to copy the file from the netlogon directory to @LanRoot\drivers\etc\, but it didnt work and exited with an error code 2 (?). I couldnt find any information on what copy meant by error 2, so I tried to work around it.
so now, Im trying to use the shell and rename lmhosts.10 to lmhosts. I must be a complete doofus, because I cannot get it to work no matter what I do. Here is what I am trying to use (the variables come from elsewhere. I wrote it so I could have one script for multiple sites).
code:
$LMHostsPath = "@LanRoot\drivers\etc\" $LMH = "$LMHostsPath" + "lmhosts." $num = 10 $string = "%comspec% /c ren $LMH$num $LMH" shell $string
This gives an error of "The syntaxt of the command is incorrect." So what exactly am I doing wrong?
also, is there a better way of doing this? I've seen people people discuss this problem, but no real resolutions.
Lastly, has anyone used Scriptlogic? I saw an ad and was checking it out, but wanted to know if its as flexible as kixtart.
_________________________
Be kind; each person is fighting his own private war.
|
|
Top
|
|
|
|
#30034 - 2002-10-01 09:10 PM
Re: Trouble with LMHOSTS
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
|
|
Top
|
|
|
|
#30035 - 2002-10-01 09:53 PM
Re: Trouble with LMHOSTS
|
Tony72
Getting the hang of it
Registered: 2002-06-18
Posts: 53
|
No, that doesnt do it. I knew it wouldnt; if you have a . there it will specify a file; sometimes it can get weird if you have a file and folder in the same directory with the same name, and the . helps you avoid problems.
As a side note, if you want a listing of all files without suffixes, you can do "dir *."
Anyway, I tried it just for fun and received the exact same error.
_________________________
Be kind; each person is fighting his own private war.
|
|
Top
|
|
|
|
#30039 - 2002-10-01 10:43 PM
Re: Trouble with LMHOSTS
|
Tony72
Getting the hang of it
Registered: 2002-06-18
Posts: 53
|
I tried something like that before, but ? had a problem displaying %comspec%. I didnt feel like using ExpandEnvironmentVars, so I didnt get into it (remember, when you drop to shell you are using a different environment).
What I did test was
code:
$LMHostsPath = "@LanRoot\drivers\etc\" $LMH = "$LMHostsPath" + "lmhosts." $num = 10 ? "/c ren $LMH$num $LMH"
which displayed correctly. I suppose if I had a real woody for it I could have used the shell and had it echo... which I will try now that I thought of it.
Also, does anyone know what went wrong with using Kixtart's copy command? This is what exited with error code 2-
code:
:COPYLMH $LMH = "$LMHostsPath" + "lmhosts." Select Case "$Loc" = "DePaul" copy "lmhosts.10" "$LMH" /h Case "$Loc" = "Lexington" copy "lmhosts.10" "$LMH" /h Case 1 copy "lmhosts.167" "$LMH" /h EndSelect Return
_________________________
Be kind; each person is fighting his own private war.
|
|
Top
|
|
|
|
#30041 - 2002-10-02 06:37 AM
Re: Trouble with LMHOSTS
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Tony72,
Les brings up a great point..
Most people cannot write to directories (folders) below Windows or Winnt.. For example, they may not be able to change files at System32\Drivers\etc..
Personally, I came across an issue with our locked down users, that they cannot write to Windows/Winnt itself. This prompted me to create a $systemdrive+"\Scripts" folder.
HTH,
Kent
|
|
Top
|
|
|
|
#30046 - 2002-10-02 05:22 PM
Re: Trouble with LMHOSTS
|
Tony72
Getting the hang of it
Registered: 2002-06-18
Posts: 53
|
1. its not a rights issue (at least not at this point), because I am testing it under an administrator account. The only errors are with either syntaxt (which APPEARS correct, at least to me), or with Kixtart itself (?!). I would guess it is the former, but the latter is possible.
2. I would like to have an INCLUDE in the LMHOSTS, but since I cannot actually replace or push the file, it becomes a moot point. Unfortunately, it seems the only solution may come by either having kix make a stub file that is used by kixtart.bat at next logon, or doing it by hand (*gasp!*) [ 02. October 2002, 17:22: Message edited by: Tony72 ]
_________________________
Be kind; each person is fighting his own private war.
|
|
Top
|
|
|
|
#30047 - 2002-10-02 05:28 PM
Re: Trouble with LMHOSTS
|
Tony72
Getting the hang of it
Registered: 2002-06-18
Posts: 53
|
oh ya, I forgot to mention: the purpose of this whole thing is because we are switching PDCs. So we need this done before they are switched, or else the Win2000 machines wont be able to log on. Win2k, on an NT4 network, will only authenticate to the PDC unless it has an LMHOSTS file that explicitly tells it the locations of other Domain Controllers. You also cannot add the machine to the domain unless it knows where the PDC is, and the before mentioned NetBIOS problem is prohibiting that currently. So any Win2k machines that are not at this site need to have an LMHOSTS file. [ 02. October 2002, 17:31: Message edited by: Tony72 ]
_________________________
Be kind; each person is fighting his own private war.
|
|
Top
|
|
|
|
#30050 - 2002-10-02 06:17 PM
Re: Trouble with LMHOSTS
|
Tony72
Getting the hang of it
Registered: 2002-06-18
Posts: 53
|
You know, there are ways of saying things without being an @$$hole. But I will try your suggestion.
_________________________
Be kind; each person is fighting his own private war.
|
|
Top
|
|
|
|
#30051 - 2002-10-02 06:29 PM
Re: Trouble with LMHOSTS
|
Tony72
Getting the hang of it
Registered: 2002-06-18
Posts: 53
|
Thanks, it worked. To answer your two questions-
1. No, you did not make yourself clear 2. No, I did not sleep thru DOS101
I actaully had been working on this problem for a very long time, and using REN was not my first option (or attempt) at doing this specific task. So pardon me, but at this point my mind is kind of burnt out. I dont run to the message board every time I have a little problem, this option is when I truly need the help.
So thanks for your help, but you should enroll in MANNERS101.
_________________________
Be kind; each person is fighting his own private war.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 699 anonymous users online.
|
|
|