kpu Posted August 19, 2005 Share Posted August 19, 2005 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. ;--------------------------------------Variables------------------------------------------- #include <file.au3> $i = 0 $regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" $regkeyval = "ProfileImagePath" $user = "Kane" ;------------------------------------------CODE-------------------------------------------- Do $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") Else ;Msgbox(16,"Not Good","I don't want to change the keys") EndIf 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. http://www.kpunderground.com Link to comment Share on other sites More sharing options...
jftuga Posted August 22, 2005 Share Posted August 22, 2005 I think you should change this... from: If @error = 1 Then ExitLoop to: If $i > 0 and "" == $sid then ExitLoop -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now