Reading a registry value from a client machine

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gracepaul
    New Member
    • Jul 2008
    • 28

    Reading a registry value from a client machine

    hi all,

    I write a javascript for reading the registry value as follows

    Code:
     
    <script language="javascript" type="text/javascript">
    <!-- 
     
    function ReadRegistry() {
    var WshShell;
    var Key;
    try
    {
    WshShell = new ActiveXObject("WScript.Shell");
    Key = WshShell.RegRead ("HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp\\TestValue"); 
     
    }catch(e)
    {
    Key='';
    }
    document.getElementById("HiddenField1").value=Key;
    }
    </script>
    But it didn't return any value.

    While using the ActiveXObject class any other points are there to be noted.

    Please reply as early as possible

    Thanks in advance
    Grace
    Last edited by DrBunchman; Jul 29 '08, 11:22 AM. Reason: Added [Code] Tags - Please use the '#' button
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Have you tried changing your code to this:
    [code=javascript]
    catch(e)
    {
    Key=e.toString( );
    }
    [/code]So you can see what the error that is being thrown is?

    Comment

    Working...