Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


setting environmental variables logon script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,60258
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> setting environmental variables logon script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 setting environmental variables logon script - 5/15/2008 7:39:40 AM   
  mtyn

 

Posts: 4
Score: 0
Joined: 5/15/2008
Status: offline
       Hi all, first time poster so go easy on me!
What I am trying to accomplish is a logon script that does two things.
One being to set and environmental variable of %fullname% containing the users first and last name.
after that the script goes on to auto setup outlook based on a prf file.

The outlook part works fine however the environmental variable is what gives me issues.
(note, I havent programed since highschool C++, i can follow but i cant make it up)
this code is mashed together from bits ive found

      
the scipt then goes on to run the outlook setup.

here is the rub, when i run this as a logon script it does not work. The variable does not set but the outlook setup runs. but if i run the script manually as a user it works perfectly!
im not quite sure why

entire code posted below for refrence

      
 
 
Post #: 1
 
 RE: setting environmental variables logon script - 5/15/2008 8:05:02 AM   
  ebgreen


Posts: 5041
Score: 31
Joined: 7/12/2005
Status: offline
Try writing to HKEY_CURRENT_USER\Environment to set the environment variable.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to mtyn)
 
 
Post #: 2
 
 RE: setting environmental variables logon script - 5/15/2008 12:27:04 PM   
  mtyn

 

Posts: 4
Score: 0
Joined: 5/15/2008
Status: offline
Thanks for your reply, could you possibly point me towards an example?
Im not kidding when I saw that I know next to nothing about vbscript. Im not asking for you to write it for me, but maybe just let me know what function I should be searching for information for.
Would power users (WinXP) have the rights to add strings to the reg?

Thanks!

< Message edited by mtyn -- 5/15/2008 12:32:55 PM >

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: setting environmental variables logon script - 5/15/2008 2:21:56 PM   
  dm_4ever


Posts: 2665
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
These may help

http://techtasks.com/code/viewbookcode/444
Reference:  http://msdn.microsoft.com/en-us/library/aa394143(VS.85).aspx

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to mtyn)
 
 
Post #: 4
 
 RE: setting environmental variables logon script - 5/16/2008 3:58:44 AM   
  mtyn

 

Posts: 4
Score: 0
Joined: 5/15/2008
Status: offline
I had found and tried to use that script when i was researching this initially, it seems that power users do not have the authority to create the value through this method.

(in reply to dm_4ever)
 
 
Post #: 5
 
 RE: setting environmental variables logon script - 5/18/2008 11:23:41 AM   
  dm_4ever


Posts: 2665
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Do a search for

WScript.Shell
RegRead
RegWrite

or

StdRegProv
SetStringValue

These should allow you to read/write from/to the registry as ebgreen suggested previously....you should be able to find example for both of these.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to mtyn)
 
 
Post #: 6
 
 RE: setting environmental variables logon script - 5/20/2008 2:30:48 AM   
  mtyn

 

Posts: 4
Score: 0
Joined: 5/15/2008
Status: offline
heres an update, i feel like im missing something pretty simple.
when i logon as a user and run this code, it creates the environmental variable and ive verified that on the command line with "set"

      

and then if i run this code, the profile is setup and the fullname is set properly

      

however if i put those two sets of code in the same file and run it it does not set the name, but rather puts %fullname% in the space, leading me to believe that the variable isnt being set. But i know that it is set.
Im guessing that when i call the vbscript it gathers the envirnmental variables and uses those while the script is running, is there a way for me to tell the script to refresh its variables?

(in reply to dm_4ever)
 
 
Post #: 7
 
 RE: setting environmental variables logon script - 5/20/2008 3:48:56 AM   
  dm_4ever


Posts: 2665
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
You may want to group things a bit more into their own Subs/Functions and there is no need for the "cleanup" sub.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to mtyn)
 
 
Post #: 8
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> setting environmental variables logon script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts