Page 1 of 2 12>
Topic Options
#37626 - 2003-03-09 07:04 PM reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
Hi there.
Im in need of making changes to the [HKCU] where i have to add a key based on the username of the person logged in.

Its a path to some files i need to add or change for the user.
But how does i make a reg key where the username is in ??

_RaVe_
_________________________
One by one the Pinguins came and took my sanity away.

Top
#37627 - 2003-03-09 07:25 PM Re: reg keys based at username
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Welcome to the board.

Of course it is possible that you can change your registry based on an username.
As example we want to modify our IExplorer starting page based on specific
username.
Our example
code:
IF (Instr("-"+@userid+"-","-MCA-_RaVe_-") <> 0)
$start_page="http://kixtart.org"
ELSE
$start_page="http://www.google.com"
ENDIF
;
IF WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Start Page", $start_page, "REG_SZ") <> 0)
? "Warning KIX: error status @error (@serror)"
ENDIF

When you need more help please tell us more about
  • which key you want to modify. possible that you need also additional rights to do that.
    as a normal user you can't always change everything.
  • are there specific rules for the users with which we have to deal. in some situations
    your value must be transfer to another value type. f.e. the owner's name in Office needs
    a binary format.
  • for which windows environment you need this solution. within windows it aren't always
    the same registry locations for all registry locations.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#37628 - 2003-03-09 08:02 PM Re: reg keys based at username
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please read the KiXtart Manual under ADDKEY
code:
$rc=ADDKEY('HKEY_CURENT_USER\SOFTWARE\'+@USERID)



[ 09. March 2003, 20:03: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#37629 - 2003-03-12 11:09 AM Re: reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
Hi again.
Ill try to make my question more specifik.

The thing is that im using citrix to host different applikations like outlook/exchange. etc etc.

I need to make add_on exchange central work for every users on my system. And to do that i need to correct the location of the sec.mdb database file (they need one standard database file / user)
normal this file is under the c:\program files\....\sintas but i need to make a key in the regestry to make the program look in another location.

so what i need is to look in the \\profile-server\profiles\%username%\applikation data\addon\ for the file sec.mdb if it dosent eksist i need to copy it to the location.

then i need to make the regestry key.
[HKCU\Software\Add-On\Products\exchange central\paths]
with a value
"DefaultDatabse"="\\profile-server\profiles\%username%\applikation data\addon\"

any sugestions how i do this ?

regards
_RaVe_
_________________________
One by one the Pinguins came and took my sanity away.

Top
#37630 - 2003-03-12 11:27 AM Re: reg keys based at username
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, I quess what you want is:
code:
$nul=writevalue("HKCU\Software\Add-On\Products\exchange central\paths","DefaultDatabse","\\profile-server\profiles\"+@userid+"\applikation data\addon\","REG_SZ")

I don't remember what was the first version that automatically creates the subkeys if they don't exist but if I remember my test version correctly, at least 4.12 supports that.
_________________________
!

download KiXnet

Top
#37631 - 2003-03-12 11:30 AM Re: reg keys based at username
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You are 95% of the way there already.

Here is some pseudo-code to help you get going:
code:
$sDatabaseSource="\\SERVER\applikation data\addon\"
$sDatabaseDestination="\\profile-server\profiles\%username%\applikation data\addon\"
If Not Exist($sDatabaseDestination)
Copy $sDatabaseSource $sDatabaseDestination
If WriteValue("HKCU\Software\Add-On\Products\exchange central\paths","DefaultDatabase","\\profile-server\profiles\%username%\applikation data\addon\","REG_SZ")
"FATAL: Cannot update database path value" ?
EndIf
EndIf


Top
#37632 - 2003-03-13 12:11 AM Re: reg keys based at username
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
silver plate once again [Frown]
_________________________
!

download KiXnet

Top
#37633 - 2003-03-15 12:32 AM Re: reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
Thx for all the advice, but still i am having trouble to get this to work, the creation of the regestry key is succesfull but i cannot get the copying of files to work.
here is my KiX script, any sugestions ??

code:
 IF INGROUP ("sintas") <> 0
$sDatabaseSource="\\FS1\Profiles$\groups\sintas\data\"
$sDatabaseDestination="\\fs1\randers-reb$\userdata\"+@USERID+"\applikation data\addon\"
If Not Exist($sDatabaseDestination)
Copy $DatabaseSource $sDarabaseDestination /s
$sintasreg = "HKCU\Software\Add-On Products\exchange central\paths"
IF KEYEXIST ($sintasreg) = 0
ADDKEY ($sintasreg)
ENDIF
IF (WriteValue($sintasreg,"DefaultDatabase","\\fs1\randers-reb$\userdata\"+@USERID+"\applikation data\addon\","REG_SZ") <> 0 )
? "Warning KIX: Error status @error (@serror)"
ENDIF
ENDIF
ENDIF

_________________________
One by one the Pinguins came and took my sanity away.

Top
#37634 - 2003-03-15 12:35 AM Re: reg keys based at username
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now I must ask you what kix-version you are trying this on.

if it's not 4.21 rc1, please try with it also.
_________________________
!

download KiXnet

Top
#37635 - 2003-03-14 01:02 PM Re: reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
hi there.
Im using kix32.exe with version number 4.20
Domain controller is a Win2k server
and the clients are also win2k servers (its a terminal server setup and this is for users login on to the terminal servers)
_________________________
One by one the Pinguins came and took my sanity away.

Top
#37636 - 2003-03-14 01:06 PM Re: reg keys based at username
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Are you're shares hidden?

If so use $$ like:

code:
$sDatabaseSource="\\FS1\Profiles$$\groups\sintas\data\"
$sDatabaseDestination="\\fs1\randers-reb$$\userdata\"+@USERID+"\applikation data\addon\"



[ 14. March 2003, 13:06: Message edited by: MightyR1 ]
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#37637 - 2003-03-14 01:15 PM Re: reg keys based at username
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
the copy and move commands have known issues with 4.20

for move stuff check our beta forum.
the copy discussion is based at scriptlogic's forum in http://www.scriptlogic.com/support/forums/display_message.asp?mid=6280

so back to my question, could you test it with 4.21 rc-1?
_________________________
!

download KiXnet

Top
#37638 - 2003-03-14 01:31 PM Re: reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
would do that if i could find it :-)
_________________________
One by one the Pinguins came and took my sanity away.

Top
#37639 - 2003-03-14 01:32 PM Re: reg keys based at username
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
http://www.gwspikval.com/jooel/files/KiX2001_421rc1.zip
_________________________
!

download KiXnet

Top
#37640 - 2003-03-14 02:01 PM Re: reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
thx.
But its same result, the files dosent get copyed.
_________________________
One by one the Pinguins came and took my sanity away.

Top
#37641 - 2003-03-14 02:48 PM Re: reg keys based at username
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, add a line after the copy line with just:
"error: " @error get $nul

in it and tell us what the error is.
thanks.
_________________________
!

download KiXnet

Top
#37642 - 2003-03-14 04:02 PM Re: reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
I have changed a bit in my script to try something.

Now the code looks like this.
code:
  $sDatabaseSource="\\FS1\Profiles$$\groups\sintas\data\"
$sDatabaseDestination="\\fs1\randers-reb$$\userdata\"+@USERID+"\addon\"
If Not Exist($sDatabaseDestination)
Copy $DatabaseSource $sDarabaseDestination /s
"error: " @error get $nul
ENDIF
$sintasreg = "HKCU\Software\Add-On Products\exchange central\paths"
IF KEYEXIST ($sintasreg) = 0
ADDKEY ($sintasreg)
ENDIF
IF (WriteValue($sintasreg,"DefaultDatabase","\\fs1\randers-reb$\userdata\"+@USERID+"\addon\","REG_SZ") <> 0 )
? "Warning KIX: Error status @error (@serror)"
ENDIF
IF (WriteValue($sintasreg,"UserData","\\fs1\randers-reb$\userdata\"+@USERID+"\addon\","REG_SZ") <> 0 )
? "Warning KIX: Error status @error (@serror)"
ENDIF
? "sleeping"
sleep 10

the result of this is

error: 78
_________________________
One by one the Pinguins came and took my sanity away.

Top
#37643 - 2003-03-14 04:07 PM Re: reg keys based at username
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, it's not proper windows error.
could you change the @error to @serror to see what kix says about it.
thanks [Smile]
_________________________
!

download KiXnet

Top
#37644 - 2003-03-14 04:14 PM Re: reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
found 1 error in this but correcting this dosent make any difference

Copy $DatabaseSource $sDarabaseDestination /s
there is misseng a s after the first $

the error code after changeing this and changing to @serror is

error: Error (317 / 13D) while rerieving error information for 4E
_________________________
One by one the Pinguins came and took my sanity away.

Top
#37645 - 2003-03-14 04:20 PM Re: reg keys based at username
_RaVe_ Offline
Fresh Scripter

Registered: 2003-03-02
Posts: 11
Whee corrected a typo and now its working ;-)

Lonkero thx for everything.
and thx for anyone else carring for my first kix script.

Would it help anyone if i posted the complete code in working form ?

Regards
_RaVe_
_________________________
One by one the Pinguins came and took my sanity away.

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.077 seconds in which 0.028 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