Re: WMI Remote Process start in VB.NET
- From: "joseomjr@xxxxxxxxx" <joseomjr@xxxxxxxxx>
- Date: 11 Jul 2006 17:29:03 -0700
Since you're copying a file and remotely executing, have you tried
SysInternal's PSExec? It has several features such as allowing you to
specify a list of computers to run it on and copying an executable to
run on those machines. This is not a WMI solution, but if it works for
your purposes then who cares.
http://www.sysinternals.com/Utilities/PsExec.html
It is the mark of an educated mind to be able to entertain a thought
without accepting it. -Aristotle
Troy wrote:
LOL. You're obviously a .Net Fan.
Gerry, maybe a better explanation of what I'm doing here will clarify things
for you...
The "Monday.exe" executable does not remain on each users drive. It is
copied to its destination from a few select points, remotely launched from
one of these points (using impersonation) to accomplish its task(s) and then
removed as we do not want this to remain on our users computers. It works
fine other than an occassional miss on random computers. Thus the reason for
the question.
VB.Net is used because that's what I know. Porting this simple app to the
2.0 framework will not take much either. However, I have to agree with you
regarding the disappointment that the .net framework is not backwards
compatible and thus destroying any hopes of "standardization". Maybe
Microsoft will put more effort into making this happen in the future....
If anyone else has any other ideas, please advise.
--
Thank you, Troy
"Gerry Hickman" wrote:
Hi,
The whole thing is horrible, have you put a separate EXE into _every_
machine's C drive? It looks more like you're trying to run a local
process than a remote one. If the program is already on C, why not just
start it on a schedule? Why use non-standards compliant VB? Why rely
(and be tied) to the bungling and bloated .NET framework (which in this
case looks like merely a wrapper around the real WMI calls?), .NET 1.1
is already dead anyway, now you need to re-write everything for .NET 2.0
and in a couple of months, you'll need to re-write it for .NET 3.0! What
a waste of time.
Troy wrote:
I have implemented this wmi remote process call in VB.NET however it does
not execute Monday.exe all the time. No errors or logs are generated from my
application nor do any eventlog messages appear on the target machine.
Please give me some direction on what may contribute to these failures on
some machines but not others. All machines have the .NET Framework 1.1
installed, WMI Service is running on all computers and I have admin rights on
all machines.
The code I'm using is listed below...
Dim execMon As String = "C:\Locale\Monday.exe "
Dim scope As ManagementScope = New ManagementScope("\\" &
strComputer & "\root\cimv2", cOptions)
Try
scope.Connect()
Catch ex2 As Exception
MsgBox("Failed to connect to " & strComputer)
End Try
Try
Dim mPath As ManagementPath = New
ManagementPath("Win32_Process")
Dim mClass As ManagementClass = New
ManagementClass(scope, mPath, New ObjectGetOptions(Nothing, New TimeSpan(0,
0, 0, 7), True))
Dim inParams2 As ManagementBaseObject =
mClass.GetMethodParameters("Create")
Dim options As InvokeMethodOptions = New
InvokeMethodOptions
inParams2("CommandLine") = execMon & uChkS & " " & cChkS
Dim mboMon As ManagementBaseObject =
mClass.InvokeMethod("Create", inParams2, options)
Dim processIDMon As Object = mboMon("processID")
'MsgBox(processIDMon.ToString)
Catch ex As Exception
MsgBox("Failed to execute application. Error message: "
& ex.message)
End Try
--
Gerry Hickman (London UK)
.
- Follow-Ups:
- Re: WMI Remote Process start in VB.NET
- From: Gerry Hickman
- Re: WMI Remote Process start in VB.NET
- References:
- Re: WMI Remote Process start in VB.NET
- From: Gerry Hickman
- Re: WMI Remote Process start in VB.NET
- From: Troy
- Re: WMI Remote Process start in VB.NET
- Prev by Date: Re: WMI Remote Process start in VB.NET
- Next by Date: Counters resetting in win32_PerfRawData_PerfDisk_PhysicalDisk class
- Previous by thread: Re: WMI Remote Process start in VB.NET
- Next by thread: Re: WMI Remote Process start in VB.NET
- Index(es):
Relevant Pages
|