I have the following VBS script for ending a process on a remote pc.
as follows

strComputer = "COMPUTERNAME"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'PROCESSNAME'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

However if I want to run this on the whole of an OU how should I go
about this? I can get a list of pcs into a text file, but how do I
have it so that the computer name is sourced from this list?

Thanks
Dan

Re: using a text file as source for strcomputer in vbs script. by Torgeir

Torgeir
Mon Jul 18 11:21:28 CDT 2005

Dan wrote:

> I have the following VBS script for ending a process on a remote pc.
> as follows
>
> strComputer = "COMPUTERNAME"
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer &
> "\root\cimv2")
> Set colProcessList = objWMIService.ExecQuery _
> ("Select * from Win32_Process Where Name = 'PROCESSNAME'")
> For Each objProcess in colProcessList
> objProcess.Terminate()
> Next
>
> However if I want to run this on the whole of an OU how should I go
> about this? I can get a list of pcs into a text file, but how do I
> have it so that the computer name is sourced from this list?
>
Hi,

An example in this link (it also uses the function IsConnectible
to see if the computer is online before trying to connect to it
with WMI):

http://groups.google.co.uk/group/microsoft.public.scripting.vbscript/msg/0e17fd9e8ee66b35?dmode=source&hl=en


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx