No data returned.

C

chris.harrod

I have a simple VBS to return some unless data (as a test) and it
works correctly.

Code:
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & "computername" & "\root\SMS
\site_PRI")

SetColmachines = objSWbemServices.ExecQuery("select ResourceID FROM
SMS_R_System")

For Each objMachine In ColMachines
ResourceID = objMachine.ResourceID
wscript.echo ResourceID
Next


However, when I turn it into an ASP I get no results. Can someone
tell me what I'm doing wrong?

Code:
<%@ LANGUAGE=VBSCRIPT %>
<html>
<%
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & "computername" & "\root\SMS
\site_PRI")

SetColmachines = objSWbemServices.ExecQuery("select ResourceID FROM
SMS_R_System")

For Each objMachine In ColMachines
%> test <%
Next
%>
</html>
 
A

Anthony Jones

I have a simple VBS to return some unless data (as a test) and it
works correctly.

Code:
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & "computername" & "\root\SMS
\site_PRI")

SetColmachines = objSWbemServices.ExecQuery("select ResourceID FROM
SMS_R_System")

For Each objMachine In ColMachines
ResourceID = objMachine.ResourceID
wscript.echo ResourceID
Next


However, when I turn it into an ASP I get no results. Can someone
tell me what I'm doing wrong?

Code:
<%@ LANGUAGE=VBSCRIPT %>
<html>
<%
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & "computername" & "\root\SMS
\site_PRI")

SetColmachines = objSWbemServices.ExecQuery("select ResourceID FROM
SMS_R_System")

For Each objMachine In ColMachines
%> test <%
Next
%>
</html>

Turn off anonymous access and turn on window integrated. Now visit the page
from browser running as the user your original code ran under.
 
C

chris.harrod

I already verified it isn't a permissions issue because I can query
for other things. Some classes in WMI work, some do not.
 
M

Mark J. McGinty

I have a simple VBS to return some unless data (as a test) and it
works correctly.

Code:
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & "computername" & "\root\SMS
\site_PRI")

SetColmachines = objSWbemServices.ExecQuery("select ResourceID FROM
SMS_R_System")

For Each objMachine In ColMachines
ResourceID = objMachine.ResourceID
wscript.echo ResourceID
Next


However, when I turn it into an ASP I get no results. Can someone
tell me what I'm doing wrong?

Other than the html tags and the word 'test' I don't see any output to the
response context, replace wscript.echo with Response.Write.


-Mark



Code:
<%@ LANGUAGE=VBSCRIPT %>
<html>
<%
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" & "computername" & "\root\SMS
\site_PRI")

SetColmachines = objSWbemServices.ExecQuery("select ResourceID FROM
SMS_R_System")

For Each objMachine In ColMachines
%> test <%
Next
%>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top