Friday, December 26, 2008

How to Create a Process on Remote Computer using VBScript WMI?

Here is a sample code to start the notepad.exe on a remote computer. This code works well with all the Windows operating system except for the advance OS like Windows XP the notepad opens in an invisible mode. In the code below you need to replace "server" with the name of the computer where you want to start the process.

strComputer = "server"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
Error = objWMIService.Create("notepad.exe", null, null, intProcessID)
If Error = 0 Then
Wscript.Echo "Notepad was started with a process ID of " & intProcessID & "."
Wscript.Echo "Notepad could not be started due to error" & Error & "."
End If

Hope this helps!


Remote Support said...

Its so highly informative things are posted in your blog. I was seeking for this type of blog only and also that you have a fresh and interesting content.
Web Conferencing

Post a Comment