Solved

Looking for a wmi script to run a vbs script remotely

Posted on 2011-03-21
1
329 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Welcome to part one of a multi-part tutorial series, VBScript for Windows System Administrators.  The goal of this series is to teach non-programmers how to write useful VBS code to automate their environment, and perform tasks faster, and in a more…
Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

861 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now