Page 2 of 2 <12
Topic Options
#74865 - 2003-05-07 09:58 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
If you download KiXtart 4 or better, you can "spool" (if you know the machine names) through to write to that key to the Remote Client Desktops. You can download the files from here at http://kixtart.org . Check the link above for "Machine Registrations in AD". It might be a little "techie," but should be able to implement.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74866 - 2003-05-07 10:01 PM Re: Loadkey problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jack, if there is only that one value to change, you have been provided with the code many times already.
if there is only that one value, you have no need what so ever to user any reg-files but directly use one single writevalue()
_________________________
!

download KiXnet

Top
#74867 - 2003-05-07 10:03 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
It is a rights issue.. Another way to approach this is to login with the rights to do so.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74868 - 2003-05-07 10:20 PM Re: Loadkey problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Most likely, it's a one-time issue. Under KiXtart 4.x it would be a matter of enumerating the computers with any of the NetView() UDFs, loop through the array and just write to the specified registry key, independent of whether the value is already set correctly or not.
code:
; pseudo-code
$comps=COMNetView()
for each $comp in $comps
$rc=writevalue('\\'+$comp+'\HKEY_LOCAL_MACHINE\...)
if @ERROR
? 'Error '+@ERROR+' = '+@SERROR+' on comp '+$comp
endif
next

_________________________
There are two types of vessels, submarines and targets.

Top
#74869 - 2003-05-07 10:21 PM Re: Loadkey problem
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Thanks kdyer i will do the upgrade. To your second post I don't think its a rights issue because I have been writing and testing the script as an admin and a regular user.

Lonkero,
In a previous post I listed the code

code:
If ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes","")=""
$RC=WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Lotus Notes","Lotus Notes","REG_SZ")
EndIf

and when I tested it I got the message
"script error : error in parameter(s) !. "

Top
#74870 - 2003-05-07 10:23 PM Re: Loadkey problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Because WRITEVALUE requires four parameters, this has already been pointed out to you in a previous post.
_________________________
There are two types of vessels, submarines and targets.

Top
#74871 - 2003-05-07 10:25 PM Re: Loadkey problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes, like jens said.
you removed the ,"" part of the code that was provided to you as silved plat without a reason and then you wonder why there is an error? [Eek!]

well, I quess after this topic you know little more about registry [Wink]
_________________________
!

download KiXnet

Top
#74872 - 2003-05-08 05:36 AM Re: Loadkey problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
There are a few methods of doing this. Copying and running a .REG file is
possible, but it will not update the key either if the user is not a
Local Administrator on the computer.

The code that Kent gave you will work during logon for a user that is a
Local Administrator. However, as far as speed goes, there is no reason
to even check the key if you already KNOW that you want it set to
Lotus Notes, just write it every time.

Kents Code:

IF READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","")<>""
$RC=WRITEVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","","Lotus Notes","REG_SZ")
ENDIF


Revised Code:

IF INGROUP("\\" + @WKSTA + "\Administrators") = 2
; The line above is compatible with KiXtart v3.60 and will check if the user is a Local Admin.
$RC=WRITEVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail","","Lotus Notes","REG_SZ")
ELSE
$nul = MESSAGEBOX("You do not have sufficient rights to modify the Lotus Notes entry. ", "Check Local Admin Rights", 4144)
ENDIF


Notice how it works with FOUR sections
SUBKEY
"HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail"
ENTRY
"" ; Note, a blank value indicates the DEFAULT value
EXPRESSION
"Lotus Notes"
DATA TYPE
"REG_SZ"

Another thing you can do is what Jens was saying. On your own workstation
create a folder called SCRIPTS. Then under SCRIPTS create a folder
called 3 and one called 4 Copy KiXtart v3.6 and your other scripts into the
3 folder. Then download and extract KiXtart v4.21-RC2
http://www.scriptlogic.com/downloads/kix/kix2001_421rc2.zip
Then copy the executable files into the 4 folder C:\SCRIPTS\4
Then you can run Administrative scripts from the C:\SCRIPTS\4 folder against
remote machines (as long as you have Admin rights on all remote machines)
Thus you could locate all remote machines and run scripts on them that will
update data directly from your workstation. Then your users woudn't need to have
Admin rights for many of your scripts.

NOTE KiXtart v4.x can use HKLM for HKEY_LOCAL_MACHINE

COMNetView is a User Defined Function and can be located here
http://www.kixhelp.com/udfs/udf/000201.htm
or here (note also that Jens says the code only works for 2000/XP systems
but since you said
quote:
all systems are running Win2K pro
it should
not be an issue.
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000201


$comps=COMNetView()
for each $comp in $comps
$rc=writevalue('\\'+$comp+'\HKLM\SOFTWARE\Clients\Mail','','Lotus Notes','REG_SZ')
if @ERROR
? 'Error '+@ERROR+' = '+@SERROR+' on comp '+$comp
endif
next

Function COMNetView(optional $domain)
Dim $list[0], $objDomain, $counter, $seed, $objComputername
Dim $filter[0]

; this function seems to only work on Windows 2000/XP computers
; even in a Windows NT 4.0 domain
if val(@INWIN)<>1 or val(@DOS)<5
exit 196
endif

$domain = trim($domain)
if $domain=''
$domain=@DOMAIN
endif

$counter = 0
$seed = 100
$filter[0]='Computer'

$objDomain = GetObject('WinNT://' + $domain + ',domain')
if @ERROR
exit @ERROR
endif
$objDomain.Filter=$filter
if @ERROR
exit @ERROR
endif
For Each $objComputername In $objDomain
$list[$counter] = $objComputername.Name
$counter = $counter + 1
if $counter > ubound($list)
redim preserve $list[$seed+ubound($list)]
endif
Next

if $counter > 0
Redim Preserve $list[$counter- 1]
endif
$objDomain = 0

$COMNetView = $list
EndFunction


Now, one thing about the code from Jens, it will run on ANY system where it locates the system
and you have Admin Rights, including SERVERS so you might want to modify the code or
create some list of SERVERS, then go back and repairs what it did. It would be better to
NOT modify anything on a Server if you don't want it that way in the first place though.

If you try the LOGON script using v3.60 of KiXtart you will notice that even if you add the
method to SHELL out and run the .REG file if you are not an Admin, you won't be able to update that key.

Oh... FYI,
If you have Admin rights on your 2000 Active Directory, you can also accomplish this with GPO as well.

[ 08. May 2003, 22:48: Message edited by: NTDOC ]

Top
#74873 - 2003-05-08 03:27 PM Re: Loadkey problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Wow. Code on a silver platter [Smile]

[ 08. May 2003, 15:27: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#74874 - 2003-05-08 03:31 PM Re: Loadkey problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, as I look at the code, I would say brown platter [Big Grin]
_________________________
!

download KiXnet

Top
#74875 - 2003-05-08 03:33 PM Re: Loadkey problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yep, there is syntax error in:
$rc=writevalue('\\'+$comp+'\"HKLM\SOFTWARE\Clients\Mail","","Lotus Notes","REG_SZ")
_________________________
!

download KiXnet

Top
#74876 - 2003-05-08 03:35 PM Re: Loadkey problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, introduced by NTDOC when he started mangling single and double quotes [Razz]
_________________________
There are two types of vessels, submarines and targets.

Top
#74877 - 2003-05-08 09:01 PM Re: Loadkey problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Introduced when I started COPY/PASTE of different users code. [Eek!]

Jens/Les LOVE ' I on the other hand use " most of the time. I play around some times trying to appease them by using the single, in this case I did a COPY/PASTE from differing code snipets.

Also note this code is NOT tested, but rather hopefully showing the user how it can be done. I'll modify the code above, but the user still should verify/modify as needed.

I should quit trying to use single/double just for the sake of Jens [Roll Eyes] lol

Thanks for pointing out the code error though guys.

Top
#74878 - 2003-05-08 09:16 PM Re: Loadkey problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I am the guilty one here.. I did the initial errors.. It just dominoed.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#74879 - 2003-05-08 09:24 PM Re: Loadkey problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
No guilt Kent.

You used the double and Jens used the single. I merged your code with Jens and did not really look at it any further. I put the double with the single and should have noticed it.

No harm done, Jack has probably left by now anyways. [Eek!]

Top
#74880 - 2003-05-08 09:30 PM Re: Loadkey problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
doc, the harm is done.
your postprepped code looks like that brown stuff now.

could you remove the additional font-tag or prep it again. thanks.
_________________________
!

download KiXnet

Top
#74881 - 2003-05-08 10:25 PM Re: Loadkey problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, thanks doc, now looks lot better!

[ 08. May 2003, 22:48: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
Page 2 of 2 <12


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

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

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