Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Problem starting process with WMI, when running vbs as service!

Reply
 
Old 11-06-2008   #1 (permalink)
Jakob.Svendsen


 
 

Problem starting process with WMI, when running vbs as service!

Hello

I have created a big script to monitor all servers in the network.

They way i do it, is to copy a small client script to the server, and
execute it remotely with WMI

i use the Win32_Process.Create() Method.

Everything works fine! i have it running at 4 customers. "main" script
is running in a user session for a administrator user on the main
server.

But now i am trying to make it run as a service with "SRVANY.exe"
utillity from Win2k3 Resource Kit.

The script executes fine locally, and writes in the log.
It reads my SQL server correctly.
But when it runs the create method i get Error 3.

Error 3 means Issuficient Permissions! And i cant figure out why!.
The User has full permissions, and i have tried with domain
administrator account too.

Here is the code snippet from the remote exec function:

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

errReturn = objWMIService.Create("wscript.exe //B " & strRemoteScript
& " " & strHostID, null, null, intProcessID)

Set objWMIService = Nothing

My System SpecsSystem Spec
Old 11-06-2008   #2 (permalink)
esska


 
 

Re: Problem starting process with WMI, when running vbs as service!

here you have an example of creating service
http://techtasks.com/code/viewbookcode/588

how to run services:
http://www.computerperformance.co.uk...cess_start.htm

I would suggest to see if there is connection with SQL server from
different machines.


My System SpecsSystem Spec
Old 11-06-2008   #3 (permalink)
Jakob.Svendsen


 
 

Re: Problem starting process with WMI, when running vbs as service!

On Nov 6, 11:54*am, esska <es...@xxxxxx> wrote:
Quote:

> here you have an example of creating servicehttp://techtasks.com/code/viewbookcode/588
>
> how to run services:http://www.computerperformance.co.uk...cess_start.htm
>
> I would suggest to see if there is connection with SQL server from
> different machines.
Hello

thanx for the quick reply.

Creating a service:
i dont need to create the service, it is created.

Running a serivce website:

thank you for the link. they use a slitly different method than me.
but the function is the same. i will try their method too tho (i just
cant right now)
only one difference, they say that

"Perhaps you expected a {impersonationLevel=impersonate}! command? The
reason that this statement is NOT needed is that the operating system
creates the process using your credentials and not those of the other
machine."
This is not true! cause when you connect to Windows 2000 Machines,
this statement is needed! as far as i know, and have tested.

The problem is not running the service, cause it works then you run
the script in user context.
It only fails when i run the script from a service with srvany.exe.


SQL:
There is no connection to SQL from the different machines, and they
dont need to.
Only the main collector needs connection to SQL.
this performance collector script has to be able to run on ALL windows
servers except NT4.
with ot without updates!

this means MDAC is not installed by default, therefore no SQL
connection can be made from the client script.

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Starting a process as another user under SYSTEM account PowerShell
Starting VS IDE with WSH causes catastrophic process failure VB Script
Diagnostics Policy Service not running + wireless connection problem Vista networking & sharing
Meda Player process starting in background - can't play videos Vista music pictures video
Error 1053 problem with starting a service Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46