Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Looking for a wmi script to run a vbs script remotely

Posted on 2011-03-21
1
Medium Priority
?
366 Views
Last Modified: 2012-05-11
Looking for a wmi script to run a vbs script remotely. For example we create a vbs script that creates a word document then edit it and saves it. If possible would like to see run on remote machine. Purpose of this script is to monitor virtual desktop environments.
0
Comment
Question by:williamfl
1 Comment
 
LVL 4

Accepted Solution

by:
Tuyau2poil earned 2000 total points
ID: 35184577

You can try this (may need impersonation) :

set objWMIService = getobject("winmgmts://" & strComputer & "/root/cimv2")

' Obtain the Win32_Process class of object.
Set objProcess = objWMIService.Get("Win32_Process")

Set objProgram = objProcess.Methods_("Create").InParameters.SpawnInstance_

objProgram.CommandLine = "cscript.exe myapp.vbs"

'Execute the program
Set strShell = objWMIService.ExecMethod( "Win32_Process", "Create", objProgram)


you can also use psexec utility. have a look to this page : http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_22932472.html



0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question