Searching through HKU and setting registry keys...

SugaBaby
SugaBaby used Ask the Experts™
on
Hi,

I have a unique problem right now.  I am trying to configure Internet Explorer for a large number of users. I use IEAK and about 80 registry keys I want to set, some are policies and others are not, but each configure features of Internet Explorer.

When running an install package, which upgrades the old version of explorer, the registry settings are not getting written - in fact, when I monitor the installation,I see the keys being written in the SID portion of the registry. For example, HKEY_USERS\S-1-5-21-1409082233-162531612-725345543-500\Software\Microsoft\FTP\Use PASV: "yes"

So, I need help or some direction on modifying these keys, so that a vbscript can variablize the unique ID number....such as connecting to HKU and searching through all S-1-5-21 and adding the keys needed - For some reason, no matter if you set them in HKLM or HKCU, they do not take effect immediately as they should.   Is this possible or doable? Any help would be appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2011

Commented:
Im not sure I am following... Sorry if I am way off to start with....

So the HKU keys are NOT being updated?

Why not use a RunOnce under HKU\.Defualt, or a login script to nail teh settings in HKCU? As long as they arent under the 2 Policies subkeys, a standard user can modify it (almost 99% true of the remainder of HKCU)...

Or are you trying to enumerate all entries under HKU? Similar to "reg query hku"

HKEY_USERS\.DEFAULT
HKEY_USERS\S-1-5-19
HKEY_USERS\S-1-5-20
HKEY_USERS\S-1-5-21-3685237707-1002384858-4048889274-1001
HKEY_USERS\S-1-5-21-3685237707-1002384858-4048889274-1001_Classes
HKEY_USERS\S-1-5-18

And then modify all user accounts starting with "S-1-5-21" (The other SIDS are the built in Service/System/Network Service accountgs), and you dont need to modify those...

Do you have all the keys/values that need to be changed?

Are you managing the ones you CAN via GPO/GPP?



Commented:
I have attached a script sample that I created and have working on Windows XP with out issues.  However, this script must also work on Windows 7 and does not.  I cannot see why it is not running or if I have done something incorrectly.  I tested this script line by line in Windows 7 without one error, yet not one key got created. Any ideas?


'On Error Resume Next

Const HKEY_USERS = &H80000003 
Const ForAppending = 8  
Const OverwriteExisting = True  
  
strComputer= "."
Set objWbem = GetObject("winmgmts:")  
Set objRegistry = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")  
Set objWMIService = GetObject("winmgmts:"  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")  
  
Set colProc = objWmiService.ExecQuery("Select Name from Win32_Process" & " Where Name='explorer.exe' and SessionID=0")  
    If colProc.Count > 0 Then  
       For Each oProcess In colProc  
       oProcess.GetOwner sUser, sDomain  
       Next  
    End If  
 
lngRtn = objRegistry.EnumKey(HKEY_USERS, "", arrRegKeys)     
  
   For Each strKey In arrRegKeys  
      If UCase(strKey) = ".DEFAULT" Or UCase(Right(strKey, 8)) = "_CLASSES" Then  
        Else  
           Set objSID = objWbem.Get("Win32_SID.SID='" & strKey & "'")  
     
      If objSID.accountname = sUser Then  
           Set WshShell = CreateObject("Wscript.Shell")
           Wscript.Sleep 150
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\NoJITSetup"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Disable Script Debugger"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Show_ChannelBand"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Anchor Underline"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Cache_Update_Frequency"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Display Inline Images"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Do404Search"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Local Page"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Save_Session_History_On_Exit"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Show_FullURL"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Show_StatusBar"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Show_ToolBar"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Show_URLinStatusBar"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Show_URLToolBar"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Start Page"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Use_DlgBox_Colors"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Search Page"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\SmoothScroll"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\FullScreen"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Window_Placement"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Use FormSuggest"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\NotifyDownloadComplete"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\AddToFavoritesExpanded"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\StatusBarOther"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Check_Associations"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\FormSuggest PW Ask"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\NoWebJITSetup"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Enable Browser Extensions"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\AllowWindowReuse"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\AutoSearch"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Print_Background"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Force Offscreen Composition"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Show image placeholders"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Error Dlg Displayed On Every Error"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Play_Background_Sounds"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Play_Animations"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Display Inline Videos"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Enable_MyPics_Hoverbar"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Enable AutoImageResize"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\ShowGoButton"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Friendly http errors"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Expand Alt Text"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\UseThemes"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Page_Transitions"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\DisableScriptDebuggerIE"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\NscSingleExpand"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Move System Caret"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\FormSuggest Passwords"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\UseClearType"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\XMLHTTP"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\DOMStorage"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\TabProcGrowth"
           WshShell.RegDelete "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\StatusBarWeb"
           Wscript.Sleep 150
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\UseClearType","no","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\CleanTIF",1, "REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\CleanCookies",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\CleanHistory",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\CleanForms",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\CleanPasswords",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\CleanInPrivateBlocking",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\UseAllowList",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\CleanPassword",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Privacy\ClearBrowsingHistoryOnExit",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Persistent",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\CleanTIF",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\CleanCookies",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\CleanHistory",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\CleanForms",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\CleanPasswords",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\CleanInPrivateBlocking",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\UseAllowList",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\CleanPassword",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Privacy\ClearBrowsingHistoryOnExit",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Use FormSuggest","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\FormSuggest Passwords","no","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\FormSuggest PW Ask","no","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Main\Use FormSuggest","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Main\FormSuggest Passwords","no","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Main\FormSuggest PW Ask","no","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\WindowsSearch\AutoCompleteGroups",5,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Policies\Microsoft\Internet Explorer\Security\DisableSecuritySettingsCheck",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\FTP\Use PASV","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\FTP\Use Web Based FTP","no","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\SmartDithering",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\BrowserEmulation\AutomaticLayoutRecovery",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Download\CheckExeSignatures","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Disable Script Debugger","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Anchor Underline","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Display Inline Images","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\XMLHTTP",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Enable Browser Extensions","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Play_Background_Sounds","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Play_Animations","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\DisableScriptDebuggerIE","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Page_Transitions",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\UseThemes",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\NotifyDownloadComplete","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\AllowWindowReuse",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Friendly http errors","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\SmoothScroll",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\Enable AutoImageResize","yes","REG_SZ"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\AutoSearch",4,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Main\DOMStorage",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\PhishingFilter\EnabledV8",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Recovery\AutoRecover",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Services\SelectionActivityButtonDisable",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Suggested Sites\Enabled",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Suggested Sites\ObjectsCreated",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Internet Explorer\Zoom\ResetTextSizeOnZoom",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\EnableHttp1_1",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\EnableNegotiate",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\UrlEncoding",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\SecureProtocols",160,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyHttp1.1",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\EnablePunycode",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\DisableIDNPrompt",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\CertificateRevocation",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\WarnonBadCertRecving",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\WarnOnPostRedirect",1,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Persistent",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\WarnonZoneCrossing",0,"REG_DWORD"
           WshShell.RegWrite "HKEY_USERS\" & strKey & "\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoComplete\Append Completion","no","REG_SZ"
           WshShell.Run "%WINDIR%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True
      End If  
   End If  
Next  
  
Set objWbem = Nothing
Set objRegistry = Nothing
Set objWMIService = Nothing
Set WshShell = Nothing
Set objSID = Nothing
Set colProc = Nothing

Open in new window

Author

Commented:
Works on XP, not sure about Windows 7

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial