none
SCCM can not delete registry key on Windows 7 via Vbs script RRS feed

  • Question

  • I am having an issue getting SCCM to delete a registry key via VBS script.   I am recieving the following error: Unable to remove registry key   code: 80070002.   Now if i double click on the VBS file it deletes it just fine.   I only get the error when running it through run advertised programs.  I have included the script command that I run.   Any help anyone can provide would be greatly appreciated.

    WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\PLAP Providers\{11660363-8F14-CA1D-BB17-814630A2009F}\"

    Thanks

    Wednesday, January 18, 2012 9:48 PM

Answers

All replies

  • Hi,

    what OS are you running? Windows 7? x86 or x64?

    It could be that you are stuck in 32-bit environment if you run x64 as the SCCM client is x86 so you will have to take that into account if you run it on a x64 machine. A little more information would be helpful.

     

    Regards,
    Jörgen


    -- My System Center blog ccmexec.com -- Twitter @ccmexec
    Wednesday, January 18, 2012 11:06 PM
    Moderator
  • are you running the script with admin rights ?

    try the VB script posted here on http://eskonr.com/2012/01/vb-script-to-remove-registry-keys/ with package as script source folder and program as scriptname.vbs

    that should do the trick.


    Please click on "vote as Helpful" if you feel this post helpful to you.

    Eswar Koneti | My Tech blog: eskonr.com | Linkedin: Eswar Koneti
    Thursday, January 19, 2012 7:12 AM
  • Thank you both for the responses.

    1st we are running SCCM 32 BIt with Windows 64Bit.

    2nd.  We tried that section of of code before and we still have the same issue.  

    The script is works fine if we double click on it and deletes the registry key. It is only when we try to run it through the SCCM client.

    could it be because when you double click on the file it runs in 64Bit natively and when we run it from SCCM it is running in 32Bit?    If you think so, how can we make the the script run in 64Bit mode?

    Any other ideas would be great. 

    Thanks again for the help.

     

    Thursday, January 19, 2012 2:25 PM
  • Use a task sequence, "run command line" step and disable x64 bit redirection.
    Torsten Meringer | http://www.mssccmfaq.de
    Thursday, January 19, 2012 3:10 PM
    Moderator
  • should we call a vbs or do something like regedit /s?  Also how do I get the source files to the task sequence?

    Thursday, January 19, 2012 3:56 PM
  • It's up to you; it doesn't matter if it's a vbs or regedit. Use the "run command line" step, place the vbscript in a package, distribute it to the DPs and select "Start in"-> "Package" (and point to the package you created). Use "cscript script.vbs" for the command line.
    Torsten Meringer | http://www.mssccmfaq.de
    Thursday, January 19, 2012 4:10 PM
    Moderator
  • we ran cscript test.vbs and pointed it to exisiting package pointing it to the source.

    Also we the start in blank.  Should we have pointed it to somehting then?

     

     

    Thanks again. 

     

    This is really a strange issue. 

    Thursday, January 19, 2012 4:56 PM
  • Sorry but doing that way it doesnt seem to run anything.   did we set it up wrong

     

    Thursday, January 19, 2012 5:17 PM
  • Does someone have copy of the VBS code that will  RegDisableReflectionKey and reanable RegReflectionKey? 

     That way we can just add that to our script and then delet the key and turn back on RegReflection.

     

     

    Thanks

    Dennis Sullvian

    Thursday, January 19, 2012 8:30 PM
  • Take a look at this post and see if it helps - http://blog.danovich.com.au/2010/04/21/considerations-when-scripting-for-64-bit-machines-with-sccm/. I've found in the past that I need to use 2 lines in a script to cater for both architectures, eg:

     

    reg delete hklm\software\microsoft\windows\currentversion\run /v stsystra /F

    %windir%\sysnative\reg delete hklm\software\microsoft\windows\currentversion\run /v stsystra /F


    My Microsoft Core Infrastructure & Systems Management blog - blog.danovich.com.au
    Thursday, January 19, 2012 10:43 PM