Re: Parse current IP address into environment variables
- From: "Al Dunbar" <alandrub@xxxxxxxxxxx>
- Date: Thu, 2 Apr 2009 23:00:09 -0600
"Chad" <chadgreenwald@xxxxxxxxx> wrote in message
news:5440b82e-7acb-448e-98ef-e316a51b2591@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 31, 11:36 pm, "Al Dunbar" <aland...@xxxxxxxxxxx> wrote:
"Chad" <chadgreenw...@xxxxxxxxx> wrote in message
news:6004c96e-7ca1-4c22-a89f-c16f1faee335@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 31, 12:08 pm, "Pegasus [MVP]" <n...@xxxxxxxxxxxxx> wrote:
"Chad" <chadgreenw...@xxxxxxxxx> wrote in message
news:85b73415-ed42-415e-97da-519a8fee6287@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
What I am looking for is a script that would read the current IP,
(Lets say its 192.168.1.161) and take the 3rd octet, (1) and set an
environment variable called Store based on its value, and also take
the 4th octet, (161) and use the last 2 digits to set an environment
variable called Terminal.
Thanks for any help,
Chad
Each process inherits its environmental variables from its "parent".
When
a
process terminates then the "child" variables are discarded. To set an
environmental variable from within a VB Script would therefore make
little
sense - unless you used a specialised tool that sets the master
environment.
Even then you would see the result only in processes that you launch
*after*
running your script. Processes that were launched *before* would be
unaware
of this variable.
I suggest you review your requirements in the light of the above
limitations.
What I am looking at doing is taking these variables, and using them
to "write" the information into several files upon the first boot of a
system, after that I won't need them anymore. I have been doing this
with a batch file that is setting the proper variables by asking the
user questions, but I would like a more seemless approach.
===> I don't understand how you can do *anything* on a computer before its
first boot. Do you mean that you want to write certain info into files on
the NEXT boot after the one where you are setting this up?
/Al
I guess I should have specified, I am putting an image on the
computer, booting it up, and using scripts to set up the IP address,
and set these fields in several files. This will not need to remain
through a reboot, as once the information is written to these files,
the computer is ready to go. Currently I use a script that requires
some user interaction (Asking the store # and Terminal #) but would
like to make it as automated as possible.
===> I am not sure what "store #" means, but I assume that "terminal #" will
form part of what will ultimately be the computername of the system being
imaged.
If the goal is to come up with a unique computername, I'd suggest basing it
on the MAC address rather than the last two digits of the last octet of the
IP address. The MAC address is guaranteed to be unique, whereas, over time,
the IP is not. But even if it was, the last two digits of xxx.xxx.xxx.161
and xxx.xxx.xxx.61 are the same.
/Al
.
- References:
- Re: Parse current IP address into environment variables
- From: Al Dunbar
- Re: Parse current IP address into environment variables
- From: Chad
- Re: Parse current IP address into environment variables
- Prev by Date: Re: batch scripting
- Next by Date: Re: Export from AD to excel filter by group
- Previous by thread: Re: Parse current IP address into environment variables
- Next by thread: Re: Script to set Static IP based on current dynamic IP
- Index(es):
Relevant Pages
|
Loading