B
Brian Nicholson
I'm building a test web application that, when run, will launch calc.exe on
my computer. It seems to work as it appears in Windows Task Manager;
however, the process doesn't actually pop up because it runs as ASPNET rather
than the user I want. When having to run ASP.NET as another user (e.g. when
doing AD queries), I was able to use IIS Windows Authentication and
impersonation. These are still enabled, but they don't seem to be helping.
Here is the method I'm using:
Sub test()
Dim objWMIService, objProcess
Dim strShell, objProgram, strComputer, strExe
strExe = "calc.exe"
' Input Box to get name of machine to run the process
strComputer = "RIC0001994"
' Connect to WMI
objWMIService = GetObject("winmgmts://" _
& strComputer & "/root/cimv2")
' Obtain the Win32_Process class of object.
objProcess = objWMIService.Get("Win32_Process")
objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
'Execute the program now at the command line.
strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
End Sub
Thanks.
my computer. It seems to work as it appears in Windows Task Manager;
however, the process doesn't actually pop up because it runs as ASPNET rather
than the user I want. When having to run ASP.NET as another user (e.g. when
doing AD queries), I was able to use IIS Windows Authentication and
impersonation. These are still enabled, but they don't seem to be helping.
Here is the method I'm using:
Sub test()
Dim objWMIService, objProcess
Dim strShell, objProgram, strComputer, strExe
strExe = "calc.exe"
' Input Box to get name of machine to run the process
strComputer = "RIC0001994"
' Connect to WMI
objWMIService = GetObject("winmgmts://" _
& strComputer & "/root/cimv2")
' Obtain the Win32_Process class of object.
objProcess = objWMIService.Get("Win32_Process")
objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
'Execute the program now at the command line.
strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
End Sub
Thanks.