Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify All Current User Keys

Status
Not open for further replies.

edms

IS-IT--Management
Dec 16, 2002
8
0
0
AU
I need to make changes to the current user key for all users on a number of PC's, is there a way to enumerate through HKEY_USERS and make the appropriate change.

I need to modify which anti virus engine is used by PKZip, the configuration which is stored in the following key;

[HKEY_CURRENT_USER\Software\PKWARE\PKZIP for Windows\VirusOption]
"Virus CL"="C:\\Program Files\\CA\\eTrust\\Antivirus\\InoUpTNG.exe"

Any help would be appreciated
Rob
 
Hello edms,

For this, it is worthwhile to consider to make it machine-wide (HKLM).

regards - tsuji
 
The setting is applied to the HKCU, are you saying that I can apply it to HKLM and this will override the HKCU setting?
 
edms,

I do not use pkzip. But judging from hkcu entry, you should be able to apply it machine-wide putting there.

<experimental>
Code:
[HKEY_LOCAL_MACHINE\Software\PKWARE\PKZIP for Windows\VirusOption]
&quot;Virus CL&quot;=&quot;C:\\Program Files\\CA\\eTrust\\Antivirus\\InoUpTNG.exe&quot;
</experimental>

It won't break your system, I don't think. Does the manual say anything negative on putting it in hklm?

- tsuji
 
Try using the following script:

Code:
Const HKU = &H80000003
     
strHKUPath = &quot;\Software\PKWARE\PKZIP for Windows\VirusOption&quot;

strPCName = InputBox(&quot;Please enter PC name to check:&quot;)

' set registry object
Set objRegistry = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\&quot; & strPCName & _
     &quot;\root\default:StdRegProv&quot;)

objRegistry.EnumKey HKU, &quot;&quot;, arrSubKeys
' loop through all SIDs
For Each subkey In arrSubKeys
     ' count SID length
     strKeyLen = Len(subkey)
     ' if SID length is longer than 16, then is a user account
     If strKeyLen > 16 Then
          ' filter out '_classes' SIDs
          If Not Right(subkey,8) = &quot;_Classes&quot; Then
               ' get HKU\SID values
               nRet = objRegistry.GetStringValue(_
                    HKU, subkey & &quot;\Software\Microsoft\Windows\CurrentVersion\Explorer&quot;, _
                    &quot;Logon User Name&quot;, strValue)
               WScript.Echo subkey & &quot; : Logon User Name : &quot; & strValue

               'nRet = objRegistry.GetStringValue(HKU, strHKUPath, &quot;Virus CL&quot;, strValue)
               'WScript.Echo subkey & &quot; : Virus CL : &quot; & strValue
               '' Set HKU\SID Values
               'nRet = objRegistry.SetStringValue(HKU, subkey & strHKUPath, _
               '     &quot;Virus CL&quot;, &quot;C:\\Program Files\\CA\\eTrust\\Antivirus\\InoUpTNG.exe&quot;)
          End If
     End If
Next

The script will prompt you for a PC to check. Currently it will loop through all of the HKU SIDs and display the username listed for each SID. I included the keys you wish to search for but commented them out since I could not test. To test just uncomment.


------------------------------------------------------------------------------
nobody knows everything about IT, so make a point to help your fellow members

-= j@ckle =-
 
Thanks j@ckle,

the script is just what I was looking for, and thanks tsuji, you solution will probably solve another issue that I have

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top