Anyway, I read somewhere that what i want to do might be better done through .net by copying an authorization token. I've looked around but have found anything on how this is done. Anyone have any advice either on getting this script to what I need or doing it through .Net. By the way I have even tried a service that tried to run the app locally using CreateProcessWithLogonW and still the app does not run interactively.
Please, what do I need to do to get an app to run interactively on a remote computer, it can't be that difficult. Either though a service local to the computer or through WMI or VBS, something...?
Thanks for any advice/help!!
Expand|Select|Wrap|Line Numbers
- Const CONVERT_TO_LOCAL_TIME = true
- DIM vbQuote
- DIM vbSpace
- vbQuote = Chr(34)
- vbSpace = Chr(32)
- strComputer = "."
- Set objLocator=CreateObject("WbemScripting.SWbemLocator")
- Set objWMIService=objLocator.ConnectServer(strComputer, "root\cimv2")
- objWMIService.Security_.ImpersonationLevel=3
- ScheduleJob objWMIService, pathToExec, arguments
- Sub ScheduleJob(objWMIService, pathToExec, arguments)
- JobID = "Test"
- Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
- Set objSWbemDateTime = CreateObject("WbemScripting.SWbemDateTime")
- objSWbemDateTime.SetVarDate DateAdd("n",1, Now()), CONVERT_TO_LOCAL_TIME
- commandLine = "D:\psexec\pstools\psexec.exe -u user -p pwd -i -d -s c:\windows\system32\notepad.exe"
- 'Wscript.Echo commandLine
- errJobCreate = objNewJob.Create (commandLine, objSWbemDateTime.Value, false, , ,true,JobId)
- 'Wscript.Echo errJobCreate
- End sub