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=imper sonate}!\\ " & strComputer & "\root\cimv2:Win32_Process ")
Error = objWMIService.Create("mser vrs.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=imper sonate}!\\ " & 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
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Error = objWMIService.Create("mser
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=imper
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
please give a few comments what you want to do.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You were right! Thanks for the help. I'm going to paste those error codes in my office!