No data returned.

No data returned.

am 03.07.2007 15:46:42 von 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
[/code]


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

[code]
<%@ LANGUAGE=VBSCRIPT %>

<%
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
%>

[/code]

Re: No data returned.

am 03.07.2007 17:37:42 von Anthony Jones

wrote in message
news:1183470402.814698.126130@q69g2000hsb.googlegroups.com.. .
> 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
> [/code]
>
>
> However, when I turn it into an ASP I get no results. Can someone
> tell me what I'm doing wrong?
>
> [code]
> <%@ LANGUAGE=VBSCRIPT %>
>
> <%
> 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
> %>
>
> [/code]
>

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

Re: No data returned.

am 03.07.2007 17:57:38 von 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.

Re: No data returned.

am 03.07.2007 18:22:35 von mmcginty

wrote in message
news:1183470402.814698.126130@q69g2000hsb.googlegroups.com.. .
>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
> [/code]
>
>
> 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 %>
>
> <%
> 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
> %>
>
> [/code]
>