Home > Archive > ASP > February 2006 > trying to use wmi with asp
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
trying to use wmi with asp
|
|
| zerbie45@gmail.com 2006-02-25, 6:55 pm |
| 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("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("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 2006-02-25, 9:55 pm |
| 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.googlegroups.com...
> 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("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" _
> & strComputer & "\root\cimv2")
>
> Set colProcess = objWMIService.ExecQuery _
> ("Select * from Win32_Process")
>
> For Each objProcess in colProcess
> strList = strList & vbCr & _
> objProcess.Name
> Next
>
> response.write strList
> ' End of List Process Example VBScript
>
> %>
>
| |
| zerbie45@gmail.com 2006-02-26, 3:55 am |
| 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.
|
|
|
|
|