Page 1 of 2 12>
Topic Options
#70153 - 2002-09-23 08:55 PM HKU/@SID vs HKCU
mjoni Offline
Fresh Scripter

Registered: 2002-05-11
Posts: 13
I'm curious why I see scripts using HKEY_USERS\SID for NT and later systems and HKEY_CURRENT_USER for 9x systems. NT and later have HKCU, why not always use HKCU?
Top
#70154 - 2002-09-23 09:02 PM Re: HKU/@SID vs HKCU
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
if you want to get into hkcu on a REMOTE machine, you need the hkey users\sid\
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#70155 - 2002-09-23 09:03 PM Re: HKU/@SID vs HKCU
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
That depends on what you want to accomplish. If you are executing an Admin type script against a remote computer you do not see HKCU. You have to select the SID representing the particular user(s) from HKU.

[ 23. September 2002, 21:04: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#70156 - 2002-09-23 09:05 PM Re: HKU/@SID vs HKCU
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
yea... what he said [Smile]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#70157 - 2002-09-23 09:07 PM Re: HKU/@SID vs HKCU
mjoni Offline
Fresh Scripter

Registered: 2002-05-11
Posts: 13
I meant to specify that the script I see use the @SID variable to identify the current user's SID. Unless you were attempting to manipulate the current user's HKCU settings on another system, you would not be able to use the @SID macro.

Can you think of another reason you would want to use HKU/@SID over HKCU?

Top
#70158 - 2002-09-23 09:35 PM Re: HKU/@SID vs HKCU
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
on a script running local, I have seen no need to use hkey users\@sid... and I only use HKCU

There may be one, but I haven't seen it
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#70159 - 2002-11-20 11:51 AM Re: HKU/@SID vs HKCU
littleJean Offline
Fresh Scripter

Registered: 2002-11-20
Posts: 8
Loc: luxembourg
I've understand the whole, but how do I recover the SID of an user, when I'm in remote ?
Top
#70160 - 2002-11-21 12:24 AM Re: HKU/@SID vs HKCU
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
check at http://www.gwspikval.com/jooel/UDF
on the leftpane there is getsid
_________________________
!

download KiXnet

Top
#70161 - 2002-11-20 04:13 PM Re: HKU/@SID vs HKCU
littleJean Offline
Fresh Scripter

Registered: 2002-11-20
Posts: 8
Loc: luxembourg
it's too difficult to use the ADSI way, I'm looking for an easiest solution.
Top
#70162 - 2002-11-20 04:20 PM Re: HKU/@SID vs HKCU
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
There is no easy way. ADSI is most likely the most efficient way without relying on external utilities. Somehow, you'll have to query the SM of the domain controller or in case of the local computer the local SAM remotely. That's what ADSI is for.

Additionally, you cannot access the CURRENT_USER registry of a user that is not logged on since that part of the registry is not loaded at that point.

Please provide us with the big picture of what you try to achieve.

[ 20. November 2002, 16:21: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#70163 - 2002-11-20 04:25 PM Re: HKU/@SID vs HKCU
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you're looking for 'easy' you're in the wrong biz.

The only other way to do it is with data mining. You catch every user in their logon script to write @SID and @UserID out to an INI file and then mine it out from the INI with your admin script. Unfortunately lyou would only catch those that actually run the logon script. Not an elegant solution and on further thought, not any easier either.

Perhaps a career change?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#70164 - 2002-11-21 02:08 PM Re: HKU/@SID vs HKCU
littleJean Offline
Fresh Scripter

Registered: 2002-11-20
Posts: 8
Loc: luxembourg
I work as Administrator on a NT4 server and I would like to update workstations NT4, 2000 and XP, who are ordinary users
For example, to install a sceensaver :

dim $filter[0]
$filter[0] = 'Computer'
$objDomain = GetObject('WinNT://' + @DOMAIN + ',domain')
$objDomain.Filter = $filter
for Each $OC in $objDomain
$res=WRITEVALUE("\\"+$OC.Name+"\HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeOut","1800","REG_SZ")
$res=WRITEVALUE("\\"+$OC.Name+"\HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ")
$res=WRITEVALUE("\\"+$OC.Name+"\HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE","////C:\WINNT\System32\logon.scr","REG_SZ")
$res=WRITEVALUE("\\"+$OC.Name+"\HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaverIsSecure","1","REG_SZ")
$res=WRITEVALUE("\\"+$OC.Name+"\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System","NoDispScrSavPage","1","REG_DWORD")
Next

This script doesn't work. The HKCU is updated but not the HKU
And for updade the HKU I need a SID.

Jean

Top
#70165 - 2002-11-21 02:14 PM Re: HKU/@SID vs HKCU
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, has anyone tried (I can't as I'm not on net now) to enum the keys HKU?
the logonname can be found in:
$name=readvalue("HKEY_USERS\"+$sid+"\Software\Microsoft\Windows\CurrentVersion\Explorer","logonname")
_________________________
!

download KiXnet

Top
#70166 - 2002-11-21 02:29 PM Re: HKU/@SID vs HKCU
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
ok.. in short terms.

What you are doing is enuming the Computers OU and retrieving all the computer names.
then you are updating the HKCU of each PC.

what you need to do then is to loop through HKU using:
code:
 $index=0
:loop1
$usersid=enumkey("\\$remotepc\HKEY_USERS",$index)
if not @error
if not instr($usersid,"classes")
$=writevalue(...)
endif
$index=$index+1
goto loop1
endif



[ 21. November 2002, 14:30: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#70167 - 2002-11-21 02:34 PM Re: HKU/@SID vs HKCU
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
classes?
_________________________
!

download KiXnet

Top
#70168 - 2002-11-21 02:35 PM Re: HKU/@SID vs HKCU
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
i dunno, but they are in there.... win2ksp3
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#70169 - 2002-11-21 02:38 PM Re: HKU/@SID vs HKCU
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I don't have.
w2k sp3

there are the local stuff like default and then local class stuff...
but only one I can see having the logon name set is the currently logged on one.
_________________________
!

download KiXnet

Top
#70170 - 2002-11-21 02:50 PM Re: HKU/@SID vs HKCU
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Admittedly I haven't fully read this thread, but if you want to list logged on users remotely, I have code on my web site.

http://mywebpages.comcast.net/habullock/kix_solutions.htm
http://mywebpages.comcast.net/habullock/Library/ListLoggedOnUsers2.kix
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#70171 - 2002-11-21 02:51 PM Re: HKU/@SID vs HKCU
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
nope, he wants to remotely configure the screensaver for all users on all PCs
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#70172 - 2002-11-21 03:37 PM Re: HKU/@SID vs HKCU
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you are not targetting a particular SID remotely then you can simple enumerate the available user hives.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 5157 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.082 seconds in which 0.033 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