stephend Posted March 25, 2014 Posted March 25, 2014 I hope this isn't too off topic, as there may be other SCCM users out there. When running a script as the logged on user (not as System) Regread and Regwrite don't work. I think this is because even though the script is running with only the user's rights it is still running to some extent in the System account - although a message box popped up from a script running in this way does show the correct username for @username. What I don't understand is why running in the same way Reg.exe does work in reading and writing to the registry as the logged on user - although I find the syntax harder :-). Does anyone understand why this is or have a workaround to get Regread etc working is this situation? Many thanks as always, Stephen
JohnOne Posted March 25, 2014 Posted March 25, 2014 HKLM = requires admin. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
stephend Posted March 25, 2014 Author Posted March 25, 2014 Sorry I didn't make it clear that I'm trying to write to the HKCU hive, so rights aren't the issue.
Moderators JLogan3o13 Posted March 25, 2014 Moderators Posted March 25, 2014 Please post your code, or a reproducer. Also, what OS, bitness, and error checking do you have in place? I use a lot of reg scripts through SCCM, but it is difficult to assist you when we cannot see what you're doing. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
stephend Posted March 25, 2014 Author Posted March 25, 2014 (edited) Hi, I'm sorry if my question wasn't clear, here is an example of regwrite that fails RegWrite("HKCU\Software\Microsoft\Office\14.0\Excel\Add-in Manager", "C:\Program Files (x86)\Datastream\Datastream Advance\AdvanceOffice.xlam", "Reg_Sz", "") and here is one that succeeds RunWait('REG ADD HKCU\Software\Microsoft\Office\15.0\Excel\Options /v ' & $searchvar & ' /t REG_SZ /d ' & '"' & '\"C:\Program Files (x86)\Microsoft Office\Office15\Library\directEDGARAddInV2.xlam\"' & '"',@TempDir,@sw_hide) They are both running on a 64bit Windows 7 client both from the same SCCM 2007 installation, both as the same user but running with "user rights". I can duplicate this at will, running the regwrite script directly rather than through SCCM does work. My question is why Regwrite doesn't work in this situation but using Reg.exe does? Thanks, Stephen Edited March 25, 2014 by stephend
Moderators JLogan3o13 Posted March 25, 2014 Moderators Posted March 25, 2014 Have you put any error checking in place? Something like this? RegWrite("HKCU\Software\Microsoft\Office\14.0\Excel\Add-in Manager", "C:\Program Files (x86)\Datastream\Datastream Advance\AdvanceOffice.xlam", "Reg_Sz", "") If @error Then FileWrite(@TempDir & "\error.txt", "Error: " & @error & " Extended: " & @extended) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
stephend Posted March 25, 2014 Author Posted March 25, 2014 Thanks, JLogan, I'll investigate further, Stephen
Developers Jos Posted March 25, 2014 Developers Posted March 25, 2014 Is the script compiled or ran as x64 or x86? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
stephend Posted March 26, 2014 Author Posted March 26, 2014 Yes Jos, the script is compiled as x86. It's very odd, it does sometimes work using Regread, Regwrite but I can't see any pattern.
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