#46192 - 2003-09-30 10:20 AM
editing reg key's
|
richard_korsten
Fresh Scripter
Registered: 2003-09-18
Posts: 5
Loc: utrecht
|
[Moderator (Sealeopard): Moved thread from 'Scripts' to 'Starters' forum due to lack of script in body]
dear board reader.
i want to edit some reg keys with kixtart. but i have a problem with the fact that the changes dont take effect right away but it need to restart. does anyone knows how to help this problem.
i am useing windows 2000 domain and 2000 ciënts.
and i can't use reg edit.
greatings richard korsten [ 30. September 2003, 15:58: Message edited by: sealeopard ]
|
|
Top
|
|
|
|
#46194 - 2003-09-30 02:09 PM
Re: editing reg key's
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Where is the script? Like Lonkero suggests - In the FAQ, there is an ABC Document..
First of all - What? What registry Key(s)? We cannot guess what you are trying to do.
Second - Why? Why is this needed?
Third - Who? Who is your target audience? Do they have rights to change these keys?
quote:
and i can't use reg edit.
We get a partial answer with this - if the client cannot use Regedit, then there is a policy/GPO been implemented on these users. I would start there, rather than hacking the Registry.
HTH,
Kent [ 30. September 2003, 14:12: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#46195 - 2003-09-30 03:08 PM
Re: editing reg key's
|
richard_korsten
Fresh Scripter
Registered: 2003-09-18
Posts: 5
Loc: utrecht
|
here is a part of the script i am going to use.
If InGroup ("Test groep") $Desktop=ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Desktop') $server=@LSERVER If 0=Exist($Destkop) Copy "\\%logonserver%\slkplgn" $Desktop If @ERROR = 0 ? "je kunt gaan werken op je pc." Sleep 20 Else ? "er is iets fout gegaan" Sleep 5 EndIf EndIf If KeyExist ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum") ? "we doen niks" Else AddKey ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum") WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum","{20D04FE0-3AEA-1069-A2D8-08002B30309D}","1","REG_DWORD") AddKey ("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum") WriteValue ("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum","{20D04FE0-3AEA-1069-A2D8-08002B30309D}","1","REG_DWORD") EndIf
but yes we have policies but what i want to change is not change able with a policy.
i know that we have to change the keys stated above.
what am i doing wrong here.
Richard
|
|
Top
|
|
|
|
#46196 - 2003-09-30 03:35 PM
Re: editing reg key's
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
The macro @LServer and the environment variable %LOGONSERVER% will both return a fully-qualified path (e.g. "\\lserver"), thus the following line has an error in it's syntax:
code:
Copy "\\%logonserver%\slkplgn" $Desktop
Try...
code:
Copy @LSERVER+"\slkplgn" $Desktop
...instead.
|
|
Top
|
|
|
|
#46198 - 2003-09-30 04:08 PM
Re: editing reg key's
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
You are missing a final ENDIF..
quote:
Warning KIXSTRIP: 1 error in block structure. missing statement(s). - do:until [0:0] - for|each:in|to:step|next [0|0:0|0:0|0] - function:endfunction [0:0] -ERROR- - if:else:endif [4:2:3] - select:case:endselect [0:0:0] - while:loop [0:0] 4 block_structures found. Informative KIXSTRIP: no UDF's found. Warning KIXSTRIP: some lines contains errors or possible errors.
This is confusing.. Are you meaning to say that there is no desktop?
IF 0=Exist($destkop)
Again, this really needs to be a GPO and Jens is right in the Registry Key containing "Policies" is a red-flag to this.
HTH,
Kent
|
|
Top
|
|
|
|
#46199 - 2003-09-30 04:20 PM
Re: editing reg key's
|
IRa
Fresh Scripter
Registered: 2003-09-09
Posts: 28
Loc: Denmark
|
Your problem is, that you are adjusting a Shell Policy. Before it is applied, the shell must be restarted.
Try this:
code:
. . . Else $Ret=WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum","{20D04FE0-3AEA-1069-A2D8-08002B30309D}","1","REG_DWORD") $Ret=FindProc("Explorer.exe",,1) EndIf Exit ;*** FindProc, curtesy Radimus FUNCTION FindPROC($PROC,optional $COMPUTER, optional $terminate) dim $GetObject, $Select if not $computer $computer=@wksta endif $GetObject="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER" $select="select * from Win32_Process where Name='$PROC'" For each $Process in GetObject("$GetObject").ExecQuery("$select") if $terminate $Ret=$Process.Terminate endif $FindPROC=$Process.ProcessId Next ENDFUNCTION
Note that the user might not have write privilege to write in Local Machine, and is not needed.
And btw, Yes it can be done with a Policy (you have to write the adm template yourself, though).
Best regards
|
|
Top
|
|
|
|
#46202 - 2003-10-02 02:42 AM
Re: editing reg key's
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
We suggest that you decrease your SLEEP values. Twenty seconds to wait for a simply message "everything is ok" can be very frustrating for users. Generally everybody can read those information within five seconds. greetings.
|
|
Top
|
|
|
|
#46203 - 2003-10-02 04:38 AM
Re: editing reg key's
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
I am becoming a convert to GPO/Policy... Too many registry hacks really muddy the water. I am with Les on this one.
If it is appropriate to edit the Registry, then by all means..
I am off my soapbox now!
Kent [ 02. October 2003, 04:39: Message edited by: kdyer ]
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 271 anonymous users online.
|
|
|