Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Internet Explorer VBScript on Intranet

Posted on 2014-11-26
3
Medium Priority
?
87 Views
Last Modified: 2014-11-26
I'm having trouble with a simple winmgts script.  I'm sure I must have a coding error, I just cannot see it.

<!DOCTYPE HTML>
<html>
<head>

  <title></title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
.result {
    border: 2px solid;
    border-radius: 50px;
    padding-top: 25px;
    padding-right: 50px;
    padding-bottom: 25px;
    padding-left: 50px;
    width:500px;
}

    </style>
<script language="VBScript">
function foo()
dim strComputer
dim objReg

on error resume next

strComputer = "."

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

If Err <> 0 Then
   foo = err.number & " " & err.description
end if

If Err = 0 Then
  foo = "ok"
Else
  foo = err.number & " " & err.description
End If

end function

</script>

<script type="text/javascript">
function myFunction() {
    document.getElementById("status").innerHTML ="Before Call to foo()";
    document.getElementById("result").innerHTML = foo();
    document.getElementById("status").innerHTML = "After Call to foo()";
}
</script>


</head>
<body onload="myFunction()">
<h3>Results should show up below</h3>
<div id="result" class="result"></div>
<hr></hr>
<br></br>
<div id="status"></div>
<p>Test 0001</p>
</body>
</html>

Open in new window


screenshotresults.jpg
0
Comment
Question by:Jeff Darling
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40467315
What version of IE?
ActiveX is disabled by default in modern versions
Goto Tools > Internet Options > Security tab
Check the settings there
0
 
LVL 13

Author Comment

by:Jeff Darling
ID: 40467334
IE 9
ActiveX is enabled
0
 
LVL 13

Author Comment

by:Jeff Darling
ID: 40467386
ok, It is definitely a security setting.  I was able to get it to work by setting the security settings to low, but I should not have to do that.

at least I know that the code is ok.  this is intended to run locally, not across the internet.

cannot do as HTA, has to be hosted on IIS...
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction ( All good things must come to an end ) The original MySQL API has gone away.  It was deprecated (years ago) by PHP in Version 5.5, and removed from PHP in all current releases .  As a result, the issue is upon us today.  It's time to …
While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question