Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Open Points: 250 Time: 12:48 - Nov 27, 2007  

bakershack

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?

Categories

Answer Discussion
Tutorials

 

oracleofDelphi

Date:: Nov 27, 2007

Time:: 12:55

what happens when you run the service from a local admin account?

oracleofDelphi

Date:: Nov 27, 2007

Time:: 13:06

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.

bakershack

Date:: Nov 27, 2007

Time:: 13:14

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.

oracleofDelphi

Date:: Nov 27, 2007

Time:: 15:21

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.

oracleofDelphi

Date:: Nov 27, 2007

Time:: 15:23

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

bakershack

Date:: Nov 27, 2007

Time:: 17:10

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.

bakershack

Date:: Nov 27, 2007

Time:: 17:10

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

oracleofDelphi

Date:: Nov 28, 2007

Time:: 09:59

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?

bakershack

Date:: Nov 28, 2007

Time:: 10:45

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.

admin

Date:: Mar 04, 2009

Time:: 10:02

The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points.

The Quomon Team

Answer 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:

Forgot Your Password?

Tutorials cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10354

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




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



Language Options

English:

www.quomon.com

Español:

www.quomon.es