Firts sorry for my bad English (I'm Spanish) and sincerly thanks for read
this.

My problem is the next; this vbscript code work fine directly from a .vbs
file in Win2k Sp4 and VBS 5.6:

Dim objWMIService, objProcess, colProcessList, proceso
proceso = "notepad.exe"
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\tsystems1\root\cimv2"
)
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process
Where Name = 'notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
msgbox "Proceso Parado"

But if it is integrated in to a IE form:

<html><head><title>Listando Procesos</title>
<SCRIPT LANGUAGE="VBScript">
Sub x1692
Dim objWMIService, objProcess, colProcessList, proceso
proceso = "notepad.exe"
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\equipo\root\cimv2")
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process
Where Name = 'notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
msgbox "Proceso Parado"
End Sub
<tr><td width='20%'>notepad.exe</td><td width='10%'>1692</td><td
width='50%'>C:\WINNT\system32\notepad.exe</td>
<td width='20%'><FORM name="frmone"><INPUT TYPE="BUTTON" value="Parar"
NAME="x1692" onclick="x1692"></FORM></td></tr>
</table></body>
</html>

D'ont show errors and no msgs appears and I stay sure that the code is ok.

My questions are;
Have win2k any security patch that make impossible execute
this code in IE form?
Anyone know how will do for execute it whitout this
problem?

Re: Someone know Why WMI actions d'ont work in to a IE form? by Alexander

Alexander
Mon Oct 11 09:58:07 CDT 2004

Hi Jose,

First of all I think You should name your form using other name than
function name.

WMI is safe for scripting, thus it is not allowed in htm. Consider using hta
(rename your htm file to hta) and call it locally.



Regards,
Alexander Fedorenko
mailto:sashaf@devplanner.com
http://devplanner.com
DevPlanner - Improve Your estimating skills!

"Jose" <piufosco@wanadoo.es> wrote in message
news:eGLlgjFrEHA.192@tk2msftngp13.phx.gbl...
> Firts sorry for my bad English (I'm Spanish) and sincerly thanks for read
> this.
>
> My problem is the next; this vbscript code work fine directly from a .vbs
> file in Win2k Sp4 and VBS 5.6:
>
> Dim objWMIService, objProcess, colProcessList, proceso
> proceso = "notepad.exe"
> Set objWMIService =
> GetObject("winmgmts:{impersonationLevel=impersonate}!\\tsystems1\root\cimv2"
> )
> Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process
> Where Name = 'notepad.exe'")
> For Each objProcess in colProcessList
> objProcess.Terminate()
> Next
> msgbox "Proceso Parado"
>
> But if it is integrated in to a IE form:
>
> <html><head><title>Listando Procesos</title>
> <SCRIPT LANGUAGE="VBScript">
> Sub x1692
> Dim objWMIService, objProcess, colProcessList, proceso
> proceso = "notepad.exe"
> Set objWMIService =
> GetObject("winmgmts:{impersonationLevel=impersonate}!\\equipo\root\cimv2")
> Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process
> Where Name = 'notepad.exe'")
> For Each objProcess in colProcessList
> objProcess.Terminate()
> Next
> msgbox "Proceso Parado"
> End Sub
> <tr><td width='20%'>notepad.exe</td><td width='10%'>1692</td><td
> width='50%'>C:\WINNT\system32\notepad.exe</td>
> <td width='20%'><FORM name="frmone"><INPUT TYPE="BUTTON" value="Parar"
> NAME="x1692" onclick="x1692"></FORM></td></tr>
> </table></body>
> </html>
>
> D'ont show errors and no msgs appears and I stay sure that the code is ok.
>
> My questions are;
> Have win2k any security patch that make impossible execute
> this code in IE form?
> Anyone know how will do for execute it whitout this
> problem?
>
>