#37626 - 2003-03-09 07:04 PM
reg keys based at username
|
_RaVe_
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
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.
|
Top
|
|
|
|
#37629 - 2003-03-12 11:09 AM
Re: reg keys based at username
|
_RaVe_
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
|
|
|
|
#37631 - 2003-03-12 11:30 AM
Re: reg keys based at username
|
Richard H.
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
|
|
|
|
#37633 - 2003-03-15 12:32 AM
Re: reg keys based at username
|
_RaVe_
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
|
|
|
|
#37635 - 2003-03-14 01:02 PM
Re: reg keys based at username
|
_RaVe_
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
|
|
|
|
#37638 - 2003-03-14 01:31 PM
Re: reg keys based at username
|
_RaVe_
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
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
|
Top
|
|
|
|
#37640 - 2003-03-14 02:01 PM
Re: reg keys based at username
|
_RaVe_
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
|
|
|
|
#37642 - 2003-03-14 04:02 PM
Re: reg keys based at username
|
_RaVe_
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
|
|
|
|
#37644 - 2003-03-14 04:14 PM
Re: reg keys based at username
|
_RaVe_
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_
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 369 anonymous users online.
|
|
|