Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining IP address via login script

Status
Not open for further replies.

mvvilleza

MIS
Joined
Nov 23, 2000
Messages
114
Location
PH
Hi all,

I'd like to know if i can determine the ip add via login script. What i would like to do is:

if ip = A
then command 1
else command 2

Thanks for any suggestions.
 
During the install of the operating system it has no clue as to the IP address.

Give use more details of what setting you are trying to install Winw2k on.

And have you completely exhausted what is available from any DHCP server?

 
I think you didn't get the question, i just want to know if it is possible to get the ip add using a login script because i want to execute some commands.
 
I would suggest doing a search on the vbscript forum.
You will find your answer there...
And the guys there will help you if you have some trouble with it...

Please tell me if I'm wrong I like to learn from my mistakes...
_____________________________________
Feed a man a fish and feed him for a day.
Teach a man to fish and feed him for a lifetime...
 
Here's a quick and very dirty vbs script to do it:

***************
CreateObject("WScript.Shell").run "%comspec% /c ipconfig > file.tmp", 0, True

with CreateObject("Scripting.FileSystemObject").GetFile("file.tmp").Openastextstream
Do While NOT .AtEndOfStream
dim x : x = .ReadLine
dim y
If InStr(x, "Address") <> 0 Then y = Mid(x, InStr(x, ":") + 2)
Loop
.Close
End With

CreateObject("WScript.Shell").run "del file.tmp", 0, True

if y = "insert the ip you're look for here" then

'first command here
'maybe: CreateObject("WScript.Shell").run "mybatchfile.bat", 0, True

else

'second command here
'CreateObject("WScript.Shell").run "myotherbatchfile.bat", 0, True

end if
*******************

Has no error checking, nor does it check for OS. Should work fine on 2000 or XP though.

________
Remember, you're unique... just like everyone else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top