Jump to content

WMI call to start a remote process


Recommended Posts

I have been working to convert some pretty standard WMI code to work in a script that I am writing, and I have hit a stump because I need to set my Path in the $objConfig.EnviromentVariables line, but can't seem to find a way to pull it off. Any help that can be provided would be appreciated.

Tom

$SW_NORMAL = 1
dim $array[2]

$strComputer = "."
$strCommand = "cobackup.exe"
$intProcessID = ""

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\"&$strComputer&"\root\cimv2")

$objStartup = $objWMIService.Get("Win32_ProcessStartup")
    $objConfig = $objStartup.SpawnInstance_
        $objConfig.ShowWindow = 0
        $objConfig.EnviromentVariables = ?????

$objProcess = $objWMIService.Get("Win32_Process")
$result = $objProcess.Create ($strCommand, "", $objConfig, $intProcessID)

msgbox (1, "", $result&" "&$intProcessID )
Anyone have a TRS 80 Model III for sale?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...