Jump to content
Sign in to follow this  

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.


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?

Share this post

Link to post
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
Sign in to follow this  

  • Create New...