No data returned.

Discussion in 'ASP General' started by chris.harrod@gmail.com, Jul 3, 2007.

  1. Guest

    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>
    
    , Jul 3, 2007
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > 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.
    Anthony Jones, Jul 3, 2007
    #2
    1. Advertising

  3. Guest

    I already verified it isn't a permissions issue because I can query
    for other things. Some classes in WMI work, some do not.
    , Jul 3, 2007
    #3
  4. <> wrote in message
    news:...
    >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>
    > 
    >
    Mark J. McGinty, Jul 3, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ben
    Replies:
    4
    Views:
    4,207
    Richard A. Michaels
    Dec 19, 2003
  2. Kostia
    Replies:
    0
    Views:
    345
    Kostia
    Apr 27, 2004
  3. Rod
    Replies:
    6
    Views:
    8,729
  4. Ian
    Replies:
    3
    Views:
    16,413
    zpradipta
    Jul 23, 2007
  5. Siva
    Replies:
    1
    Views:
    445
    =?Utf-8?B?UmljaA==?=
    Apr 17, 2006
Loading...

Share This Page