Re: Using WMI from Within a service.
- From: removethis <"colini(removethis)"@alumni.utexas.net>
- Date: Tue, 03 Oct 2006 10:54:56 -0500
guillaume.gerard@xxxxxxxxx wrote:
Dear Gerry,
Thank you for your answer. Let me clarify the operations I performed.
I have got a srvany.exe service that starts a vbscript. This vbscript
performes the following operations :
-------------------------------------------------------------------------
err.clear
Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_" & printer_ip
objNewPort.Protocol = 1
objNewPort.HostAddress = printer_ip
objNewPort.PortNumber = printer_port
objNewPort.SNMPEnabled = True
objNewPort.SNMPCommunity = "public"
objNewPort.Put_
if err.number<>0 then
LogtoFile "Errors detected during printer port installation - return
code = "&err.number
Erreur
end if
-------------------------------------------------------------------------
The objNewPort.Put_ method returns the following error: 0x80041003 =
Acces Denied.
When I run the script within a user session, it works well.
Please, tell me if you require further information.
Gerry Hickman a écrit :
guillaume.gerard@xxxxxxxxx wrote:
When the script is executed using a local account, without the srvanyYou mean you can set up a printer on a remote server using a local account?
service, everything goes right.
What ever the answer is, you need to be more specific about exactly what
you are doing with this printer queue (or printer connection, or driver
installation). The access level required will depend on what you are
actually doing...
--
Gerry Hickman (London UK)
I'm experiencing a similar problem. During development I run my Windows Service (C# .net 1.1) application on the console as a normal User account. I'm able to create WMI event queries on remote servers without any problems.
But when I install the application as a Service (LOCAL SYSTEM) the attempts to make event queries fail with mysterious 'Invalid Parameter' error.
I was under the impression that LOCAL SYSTEM has privileges similar to a local Administrator, and definitely has more privileges than my normal User development account (not even Power User.)
My dev machine is win2000 and I'm connecting to 2000, XP and Server 2003 systems.
Any advice greatly appreciated.
Colin
.
- Follow-Ups:
- Re: Using WMI from Within a service.
- From: Scooby
- Re: Using WMI from Within a service.
- Prev by Date: Re: Win32_LogicalShareSecuritySetting not returning results
- Next by Date: Multiple WMI Connections
- Previous by thread: Re: Win32_LogicalShareSecuritySetting not returning results
- Next by thread: Re: Using WMI from Within a service.
- Index(es):
Relevant Pages
|
Loading