Re: Parse current IP address into environment variables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"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


.



Relevant Pages

  • Parse current IP address into environment variables
    ... What I am looking for is a script that would read the current IP, ... environment variable called Store based on its value, ... the 4th octet, and use the last 2 digits to set an environment ...
    (microsoft.public.scripting.vbscript)
  • Re: bigint queston C++ classes
    ... I suggest an array of unsigned char, or unsigned short, or perhaps unsigned ... You'll need ceil/log) base-b digits to store x, ... these are not strings, ...
    (comp.programming)
  • Re: bigint queston C++ classes
    ... I suggest an array of unsigned char, or unsigned short, or perhaps unsigned ... routine for turning the end result into base ten for display, ... You'll need ceil/log) base-b digits to store x, ...
    (comp.programming)
  • Re: Check for a numeric string of fixed length
    ... My mistake was forgetting the end of line delimiter, And now I understand why the /^$/ didn't work: I knew nothing about the --re-interval switch and this makes my life easier since in another test I'll have to check out for a 10 digits number so this would have been forcing me to use a 10 times repeated sequence. ... at the moment I'm writing and testing this script on an Ubuntu dapper machine and it seems to be running mawk ... so, since there may be a need to run this script on a Solaris or Unixware machine, do I have to accept to use a so long regexp for a 10 digits number? ...
    (comp.lang.awk)
  • Re: How to authentificate an user via telephon?
    ... the last 4 digits of the users ssn & birthdate against our ERP software. ... in the script, and see if that user's name is returned in the response. ...
    (Security-Basics)