Windows Hosting Script Error

dsteph944
dsteph944 used Ask the Experts™
on
Hi, I'm running the following script on Windows 2000 Advanced Server:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process")

Error = objWMIService.Create("mservrs.exe", null, null, intProcessID)
If Error = 0 Then
    Wscript.Echo "MServer was started with a process ID of " _
         & intProcessID & "."
Else
    Wscript.Echo "MServer could not be started due to error " & _
        Error & "."
End If

When it runs, I get :"Mserver cound not be started due to error 9"

I use this same script to stop this process and it works fine:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'mservrs.exe'")
For Each objProcess in colProcessList
    objProcess.Terminate()
Next
 I'm using WSH 5.5.  What is an error 9?  Thanks. Deb
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Falco Bethkeperformance engineering

Commented:
please give a few comments what you want to do.

Author

Commented:
I'm trying to automate the starting of a process.  The bottom script which works terminates a process called 'mservrs.exe'.  I need to be able to start the same process in an automated fashion.
Falco Bethkeperformance engineering

Commented:
and it cannot be the missing path in "mservrs.exe"...?
performance engineering
Commented:
my guess seems to be right:

error codes:

Value:Meaning

0: Successful completion
2: Access denied
3: Insufficient privilege
8: Unknown failure
9: Path not found
21: Invalid parameter

Author

Commented:
You were right!  Thanks for the help.  I'm going to paste those error codes in my office!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial