trying to use wmi with asp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zerbie45@gmail.com

    trying to use wmi with asp

    Hi guys,

    I have the following vbscript that works just fine but when I try to
    run it using asp (just by adding the <% and %> signs and replacing
    wscript.echo with write.response) it doesn't work.

    Is there anything else I need to do to run this script using an ASP
    page ?

    Thanks in advance!

    <%
    Option Explicit
    Dim objWMIService, objProcess, colProcess
    Dim strComputer, strList

    strComputer = "."

    Set objWMIService = GetObject("winm gmts:" _
    & "{impersonation Level=impersona te}!\\" _
    & strComputer & "\root\cimv 2")

    Set colProcess = objWMIService.E xecQuery _
    ("Select * from Win32_Process")

    For Each objProcess in colProcess
    strList = strList & vbCr & _
    objProcess.Name
    Next

    response.write strList
    ' End of List Process Example VBScript

    %>

  • Bob Lehmann

    #2
    Re: trying to use wmi with asp

    First of all, "it doesn't work" is not at all helpful. My razor doesn't
    work; What's wrong?

    Your problems are likely due to the fact that your .vbs scripts run under
    your user account, while asp scripts run under the IUSR_xxxx account, which
    has limited permissions.

    Bob Lehmann


    <zerbie45@gmail .com> wrote in message
    news:1140901993 .895216.312580@ j33g2000cwa.goo glegroups.com.. .[color=blue]
    > Hi guys,
    >
    > I have the following vbscript that works just fine but when I try to
    > run it using asp (just by adding the <% and %> signs and replacing
    > wscript.echo with write.response) it doesn't work.
    >
    > Is there anything else I need to do to run this script using an ASP
    > page ?
    >
    > Thanks in advance!
    >
    > <%
    > Option Explicit
    > Dim objWMIService, objProcess, colProcess
    > Dim strComputer, strList
    >
    > strComputer = "."
    >
    > Set objWMIService = GetObject("winm gmts:" _
    > & "{impersonation Level=impersona te}!\\" _
    > & strComputer & "\root\cimv 2")
    >
    > Set colProcess = objWMIService.E xecQuery _
    > ("Select * from Win32_Process")
    >
    > For Each objProcess in colProcess
    > strList = strList & vbCr & _
    > objProcess.Name
    > Next
    >
    > response.write strList
    > ' End of List Process Example VBScript
    >
    > %>
    >[/color]


    Comment

    • zerbie45@gmail.com

      #3
      Re: trying to use wmi with asp

      Thank you bob for your reply, this will help. Take it easy, I'm not a
      f*****g smart ass as you are. Be patient with beginners.

      Comment

      • mtech
        New Member
        • Apr 2006
        • 1

        #4
        Exuse me for the mistakes I'm not an english man,
        for me I try to execut the script ASP under a rights adminstrativs because when I want to lanche the page asp the browser request for the login and password, I type the administrator login but the script did not work.
        Last edited by mtech; Apr 14 '06, 07:38 AM.

        Comment

        Working...