Jump to content

Regread not working from SCCM script running as current user


Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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!

Link to comment
Share on other sites

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 by stephend
Link to comment
Share on other sites

  • Moderators

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!

Link to comment
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
 Share

×
×
  • Create New...