Page 1 of 1 1
Topic Options
#121586 - 2004-06-21 05:58 PM Remote Registry Update
Voigtsy Offline
Lurker

Registered: 2004-06-21
Posts: 2
Loc: Bucks, England
Hi.
How do i update a registry key on a remote computer using Kixtart.
Thanks
Voigtsy

Top
#121587 - 2004-06-21 06:28 PM Re: Remote Registry Update
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
You mean like...

$null = WriteValue ("\\remotepcname\HKLM\Software\Microsoft...","entry","expression",REG_SZ)

Top
#121588 - 2004-06-21 08:55 PM Re: Remote Registry Update
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hello Voigtsy and welcome to the board.

Here is an example UDF based on the UDF by Jens located here, but this supports a remote system

UpdateRegistry() - Updates a registry setting
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=82157

Break On
Dim $SO,$SearchList
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')

; Example updates the DNS search list in the registry
$SearchList = 'brooks.com,brook-1.com,welshing.com,nenavan.com,blakrt.com'
RegUpdate('computername','HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters','SearchList',$SearchList,'REG_SZ')
? 'Registry Update was: ' + @ERROR

Function RegUpdate($System,$SubKey,$Entry,$Expression,optional $DataType)
Dim $RC,$RegUpdate,$CurrentDataType,$CurrentEntry,$Remote
If $System = "" $Remote = @WKSTA Else $Remote = $System EndIf
$Remote = Join(Split($Remote, '\'), '', 3)
$Remote = IIf($Remote <> '', '\\' + $Remote + '\', $Remote)
$RegUpdate=0
If $DataType=""
$DataType='REG_SZ'
EndIf
$CurrentDataType=ReadType($SubKey,$Entry)
$CurrentEntry=ReadValue($SubKey,$Entry)
If $CurrentEntry<>$Entry Or $CurrentDataType<>$DataType
$RC = WriteValue($SubKey,$Entry,$Expression,$DataType)
If @ERROR
Exit @ERROR
EndIF
$RegUpdate=1
EndIf
Exit @ERROR
EndFunction

Top
#121589 - 2004-06-21 09:20 PM Re: Remote Registry Update
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I don't know about you guys... trying to confuse?

The question was "How do i update a registry key"...

Shane shows how to update a value, not a key...

DOC throws a UDF at him...

Nobody asked him what aspect of the "key" he wanted to update. Mind you, Shane is probably closer to the mark in that Voigtsy probably does not know his Keys from his Values.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#121590 - 2004-06-21 10:42 PM Re: Remote Registry Update
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
That was my assumption as well Les...But if I was wrong...oh well. Certainly not the first time.
Top
#121591 - 2004-06-21 11:31 PM Re: Remote Registry Update
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
LOL
I thought there was an unwritten rule about not hitting newbies with UDFs without a providing a bit of clarity and explanation.

Figured someone may just one-up the UDF post and offer up the code resulting from the golf challenge:
New KiXtart Golf Challenge! (extended to Saturday, July 20, 6pm EST )
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#121592 - 2004-06-22 12:50 AM Re: Remote Registry Update
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
LOL you're right Les, but it was a good place to test the new PostPrep so couldn't resist.

Voigtsy,
Did we answer your question or do you need further assitance with how to perform this task. Please let us know.

Top
#121593 - 2004-06-22 09:20 AM Re: Remote Registry Update
Voigtsy Offline
Lurker

Registered: 2004-06-21
Posts: 2
Loc: Bucks, England
Thanks for the help. I do know my keys from my values. I am trying to inport a file into the registry. I have tried the usual methods. 'LOADKEY' was the option that seemed to work best but would only work on the local workstation. Am i missing the point or do i need another tool to get this to work.
I will have a look through your answers and give them a blast this morning.
I am trying to import the file into:
HKEY_LOCAL_MACHINE\SOFTWARE\

Thanks again.
Voigtsy

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
1 registered (morganw) and 925 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.108 seconds in which 0.013 seconds were spent on a total of 12 queries. Zlib compression enabled.

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