Page 1 of 1 1
Topic Options
#189257 - 2008-08-25 02:44 PM Need help with environment variables in the registry
Mr_Chicken Offline
Just in Town

Registered: 2008-08-25
Posts: 1
I need to have variables posted into the registry as they are typed vs having the logon script put in what it sees in the fields. Not everyone has rights to these areas in the registry so I would like to make this a perm fix, I would hate to manually put these keys in on 2500+ computers.

This is the issue, when charlie logs on to the computer it changes the my computer name to charlie, but when susie logs on to the same computer it keeps the name of charlie. If I could keep the %username% in tact vs having the username plugged into the registry, it would make my life much easier.

Top
#189261 - 2008-08-25 04:05 PM Re: Need help with environment variables in the registry [Re: Mr_Chicken]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
If you're referring to
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D : LocalizedString
value, the default data type is REG_SZ. You need to DELETE that value and then CREATE it as a REG_EXP_SZ so that environment variables are expanded.

You can push this out to all systems using a central script with admin rights, and it will automatically use the current user's name if you load it with something like "%USERNAME% on %COMPUTERNAME%".

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189268 - 2008-08-25 08:52 PM Re: Need help with environment variables in the registry [Re: Glenn Barnas]
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Mr_Chicken,

We had to do a similar thing in our Citrix Environment:
 Code:
    $envirolocation='HKCU\Environment'
    $temp=ReadValue($envirolocation,'TEMP')
    $tmp=ReadValue($envirolocation,'TMP')
    $tmpvar=Chr(37)+Chr(83)+Chr(121)+Chr(115)+Chr(116)+Chr(101)+Chr(109)+Chr(68)+Chr(114)+Chr(105)+Chr(118)+Chr(101)+Chr(37)
    IF $temp='' OR $temp='N:\TEMP'
       $rc=WriteValue($envirolocation,'TEMP',$tmpvar+'\Temp','REG_EXPAND_SZ')
    ENDIF
    IF $tmp='' OR $tmp='N:\TEMP'
       $rc=WriteValue($envirolocation,'TMP',$tmpvar+'\Temp','REG_EXPAND_SZ')
    ENDIF

    $newtmpval=ReadValue($envirolocation,'TEMP')

    IF %temp%=''
       SET 'TEMP='+$newtmpval
    ENDIF

    IF %tmp%=''
       SET 'TMP='+$newtmpval
    ENDIF


If you need to know what the chr() codes are, go to: http://asciitable.com

HTH,

Kent


Edited by Kdyer (2008-08-25 08:54 PM)
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.234 seconds in which 0.199 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org