Re: WMI Remote Process start in VB.NET

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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)


.



Relevant Pages

  • Re: SP3 potential problem
    ... Open Windows Explorer and check for the two files. ... Enquire, plan and execute ... I have not been able to download Net Framework ... item that appear on the support site for my machine. ...
    (microsoft.public.windowsxp.basics)
  • Re: SP3 potential problem
    ... Enquire, plan and execute ... download the Net framework updates. ... Net Framework items from my machine. ...
    (microsoft.public.windowsxp.basics)
  • RE: How Do I Extract Data from my Form to load new table records?
    ... Steve: I have adapted your code as follows, but am ... Dim strSQL As String ... Open a "template table with a number of predefined "standard" rows ... file has 10 records in it, then every time I execute this, I would be adding ...
    (microsoft.public.access.formscoding)
  • Re: Execute Method for Find Object
    ... During each iteration of the While loop, if .Execute returns ... Dim strSearch As String, strTerm As String ... Dim intIndex As Integer, intCounter As Integer, intLast As Integer ...
    (microsoft.public.word.vba.beginners)
  • Re: Database Extract Automation
    ... > database to execute JET SQL statements to move the data across. ... > Dim dbWSec 'As DAO.Workspace ... > 'Add code here to make sure UnsecuredDB doesn't ...
    (microsoft.public.access.externaldata)