Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 25th, 2006, 09:26 PM
zerbie45@gmail.com
Guest
 
Posts: n/a
Default 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("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

%>

  #2  
Old February 26th, 2006, 02:25 AM
Bob Lehmann
Guest
 
Posts: n/a
Default 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.googlegr oups.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("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
>
> %>
>[/color]


  #3  
Old February 26th, 2006, 05:15 AM
zerbie45@gmail.com
Guest
 
Posts: n/a
Default 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.

  #4  
Old April 11th, 2006, 09:58 AM
Newbie
 
Join Date: Apr 2006
Posts: 1
Default

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; April 14th, 2006 at 08:38 AM.
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles