Jeff Darling
asked on
Internet Explorer VBScript on Intranet
I'm having trouble with a simple winmgts script. I'm sure I must have a coding error, I just cannot see it.
results.jpg
<!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>
results.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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...
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...
ASKER
ActiveX is enabled