Link to home
Start Free TrialLog in
Avatar of dsteph944
dsteph944

asked on

Windows Hosting Script Error

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
Avatar of Falco Bethke
Falco Bethke
Flag of Germany image

please give a few comments what you want to do.
Avatar of dsteph944
dsteph944

ASKER

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.
and it cannot be the missing path in "mservrs.exe"...?
ASKER CERTIFIED SOLUTION
Avatar of Falco Bethke
Falco Bethke
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You were right!  Thanks for the help.  I'm going to paste those error codes in my office!