Jump to content

Recommended Posts

Here's something that may help someone. We run into situations at work where we need to change a registry key under a current user's profile using Zenworks. You can't change the current users key using "HKCU" since it will do it under the systems profile. Since that was the case I came up with the following.

#include <file.au3>
$i = 0
$regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\"
$regkeyval = "ProfileImagePath" 
$user = "Kane"
    $val = RegEnumkey($regkey,$i)
    $sid = RegRead ( $regkey & $val, $regkeyval)
    $i = $i + 1
    If @error = 1 Then ExitLoop
Until $sid = "%SystemDrive%\Documents and Settings\" & $user

;Msgbox(0,"Found User Profile","Found it at SID:" & $val & @CR & "Key is:" & $sid)

If $sid = "%SystemDrive%\Documents and Settings\" & $user  Then
; Below is some examples of what you could change
;RegWrite('HKEY_USERS\' & $sid & '\Control Panel\Desktop\WindowMetrics',"ScrollHeight", "REG_SZ", "-225")
;RegWrite('HKEY_USERS\' & $sid & '\Control Panel\Desktop\WindowMetrics',"ScrollWidth", "REG_SZ", "-225")    

;MsgBox(64,"Success","Everything Worked Well")
;Msgbox(16,"Not Good","I don't want to change the keys")

If someone knows of an easier way, please post it. Some other ideas is using the INI fuction of AutoIt to set what keys it will change or what username to look for.

I Hope this comes in handy for someone.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...