Register  |  Login

Question Details    

   Question

Time: 12:48 - Nov 27, 2007     Asked by: bakershack      Status: Unanswered      Points: 250   

Please Help! My windows service has permissions problems running a macro in an Excel spreadsheet.

I have a macro in an Excel spreadsheet that connects to an OPC server to retrieve data. I works just fine when I run it manually, or when I run it programmatically from a standard windows program. But when I try to do it from a service (running the same code as the standard windows program), it fails.

If I run the service from the Local System account, it opens the spreadsheet but completely loses track of the Excel object and cannot close it. If I then check "Allow service to interact with Desktop", it opens the spreadsheet and runs the macro, but the macro then doesn't have permission to access the OPC server. If I run the service from the Administrator account, the service does nothing - no event log entries or anything. Can someone PLEASE help me quickly with this?

Ask a New Question

Become a Quomon Expert

Current Categories

 

Other Questions Needing Answers


   

Answer Discussion
Answer Discussion
Answer Summaries
Answer Summary
 
what happens when you run the service from a local admin account?

Expert:

oracleofDelphi

Date:

Nov 27, 2007

Time:

12:55

 

Votes: Good (0) | Bad (0)
Login to rate this answer

what makes sense is that your service is running the account with local system privilages, yet the current user is the account with permission to access the OPC server, if this is a domain environment, create a user account with permission to access the opc server. then on the workstation, right click on "my computer" and find the manage user's button. change that user to a local aministrator. now configure your service to use that username and password and you should be golden.

Expert:

oracleofDelphi

Date:

Nov 27, 2007

Time:

13:06

 

Votes: Good (0) | Bad (0)
Login to rate this answer

This is a system with no network connection except to the DCS system (fancy PLCs). It is running the DeltaV HMI, and I am trying ot connect to the DeltaV OPC server. It is running on the Administrator account or the Local System account, whichever one I set it to, with the (broken) functionality I described above.

It is not a domain environment.

I can't understand why, when it is running on the Administrator account, it does absolutely nothing - not even logging to the event log. I have lots of events being written in the code, but none of them are being written. Does this help explain the problem better? I am already trying to run it on the Administrator account, and it does even less than when running on the Local System account.

Expert:

bakershack

Date:

Nov 27, 2007

Time:

13:14

 

Votes: Good (0) | Bad (0)
Login to rate this answer

try using the logon:
NT AUTHORITY\NetworkService
as the username for the service or better yet, use the username you are currently logged in as.
what I'm thinking is that the windows isn't allowing multiple logins to the opc server, (windows does this especially with shared folders) if you have any mapped drives, you might want to temporarily disconnect them also. what you want to do is make sure the service is using the same logon credentials that you're using when you log in to the computer.

Expert:

oracleofDelphi

Date:

Nov 27, 2007

Time:

15:21

 

Votes: Good (0) | Bad (0)
Login to rate this answer

you can view current credentials to network resources by typing in
net use
into the command prompt. 

Expert:

oracleofDelphi

Date:

Nov 27, 2007

Time:

15:23

 

Votes: Good (0) | Bad (0)
Login to rate this answer

Thanks - Sorry for the delay. I did not have access to the internet again until just now. I did use the username I was logged in as - Administrator. That was the case where nothing happened at all with the service. There are no mapped drives, and the only thing networked is the DCS system. DeltaV may be the problem. At this point I don't know what else it could be. I left a non-service band-aid solution in place. When I can go back (to the client site) I will play with the net use command to see if I can see anything out of whack. Thanks for trying.

Expert:

bakershack

Date:

Nov 27, 2007

Time:

17:10

 

Votes: Good (0) | Bad (0)
Login to rate this answer

I will get back to this, but it may be a couple of weeks.

Expert:

bakershack

Date:

Nov 27, 2007

Time:

17:10

 

Votes: Good (0) | Bad (0)
Login to rate this answer

the non-service band aid may have to be a more permanent solution. I read somewhere that services and macros don't go well together. if I find the article again I'll post it. is there a VB script approach that you might be able to use?

Expert:

oracleofDelphi

Date:

Nov 28, 2007

Time:

09:59

 

Votes: Good (0) | Bad (0)
Login to rate this answer

I would be very interested in that article if you can find it. The thing is, my service runs just fine with the test macros I used, so it must be an authentication problem when run on the Local System. I just don't understand why it does absolutely nothing when I run it on the Administrator account.

Expert:

bakershack

Date:

Nov 28, 2007

Time:

10:45

 

Votes: Good (0) | Bad (0)
Login to rate this answer

 

Answer Summary Currently Unavailable.

Answer Summaries cannot be submitted until the Answer Discussion is complete.

If you have an Answer for this question, submit it in the Answer Discussion area.




Respond to this question:

New User

  Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:


Forgotten Password

 

   

"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it


All Questions


Language Options

English:

www.quomon.com

Español:

www.quomon.es

Quomon Blog

blog.quomon.com

Sponsors

Questions and Answers Software
Real Estate Postcards
Marketing Fulfillment