#70153 - 2002-09-23 08:55 PM
HKU/@SID vs HKCU
|
mjoni
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
   
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\
|
|
Top
|
|
|
|
#70155 - 2002-09-23 09:03 PM
Re: HKU/@SID vs HKCU
|
Howard Bullock
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 ]
|
|
Top
|
|
|
|
#70156 - 2002-09-23 09:05 PM
Re: HKU/@SID vs HKCU
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
yea... what he said
|
|
Top
|
|
|
|
#70157 - 2002-09-23 09:07 PM
Re: HKU/@SID vs HKCU
|
mjoni
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
   
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
|
|
Top
|
|
|
|
#70159 - 2002-11-20 11:51 AM
Re: HKU/@SID vs HKCU
|
littleJean
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
|
|
|
|
#70161 - 2002-11-20 04:13 PM
Re: HKU/@SID vs HKCU
|
littleJean
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
|
|
|
|
#70164 - 2002-11-21 02:08 PM
Re: HKU/@SID vs HKCU
|
littleJean
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
|
|
|
|
#70166 - 2002-11-21 02:29 PM
Re: HKU/@SID vs HKCU
|
Radimus
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 ]
|
|
Top
|
|
|
|
#70168 - 2002-11-21 02:35 PM
Re: HKU/@SID vs HKCU
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
i dunno, but they are in there.... win2ksp3
|
|
Top
|
|
|
|
#70170 - 2002-11-21 02:50 PM
Re: HKU/@SID vs HKCU
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#70171 - 2002-11-21 02:51 PM
Re: HKU/@SID vs HKCU
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
nope, he wants to remotely configure the screensaver for all users on all PCs
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 5139 anonymous users online.
|
|
|