Re: Unexpected retrieved value in Environment Varaibles
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Tue, 25 Mar 2008 21:45:54 +0100
"Marten" <absolute88@xxxxxxxxxxx> wrote in message
news:pv6iu3p5chmbf5covv5pq0e45jfehve50a@xxxxxxxxxx
I'm getting mixed and unexpected values when trying to retrieve an
environment variable I had created. Hopefully someone can see what
I've missed.
From code I've found in the forums, I've pieced together a quick and
dirty little hardware inventory script that I call from the main login
script. (All the scripts are VBS.)
In the main script I set an environment variable indicating which
office the user is connecting from.
objWSS.Environment("VOLATILE")(EnvVarName) = EnvVarValue
where for example EnvVanrName = "Location" and EnvVarValue =
"Toronto".
The invenory routine retrieves the environment variable with
getEnviroVar = objShell.ExpandEnvironmentStrings("%" & EnvVar
& "%")
and writes it to a text file. One file per user login. The file gets
replaced each time the user logs in. Items are TAB delimited.
I then have a third vbs script that opens all the little text files
and inputs the ReadLine into an Excel spread***.
Everything looks great. Except that darn office indicator.
Some desk give the location and some give the variable:
WPGENGDPETER-S Microsoft Windows XP Professional Intel(R)
Pentium(R) 4 CPU 3.00GHz Winnipeg
WPGAGEDKAREN-H2 Microsoft Windows XP Professional Intel(R)
Pentium(R) D CPU 3.40GHz %MCWlocation%
Anyone have any ideas?
Marten
I tend to obtain my environmental variables like so:
Set objWshShell = WScript.CreateObject("WScript.Shell")
wscript.echo "Path=" & objWshShell.Environment("PROCESS")("Path")
.
- References:
- Unexpected retrieved value in Environment Varaibles
- From: Marten
- Unexpected retrieved value in Environment Varaibles
- Prev by Date: Re: Cross Child-Domain Scripting
- Next by Date: Re: call a vbscript-function from a html-page
- Previous by thread: Unexpected retrieved value in Environment Varaibles
- Index(es):