views:

468

answers:

2

I'm working on a Windows Service that one of its tasks is archiving files on remote machine but I've a problem regarding access privileges in case of Workgroup.

A: 

You can run it under user account that has access privileges on remote machine.

Or you can use impersonation when accessing remote machine. For impersonation you will need username and password that has access to remote machine. Look here for some code on impersonating in .net http://blogs.msdn.com/shawnfa/archive/2005/03/22/400749.aspx

Alex Reitbort
+1  A: 

The simplest way is to mirror the username and password on both machines, creating the same account on both machines, then run your service under that account. As you're in a workgroup and not a domain the remote login will work, but once you're in a domain that no longer works.

You cannot use any of the built in service accounts (Network Service, Local Service, Local System for this)

blowdart
Do you mean creating the same account on both machines?Also, which type of account will be used for the service, local, network, ...?
Ahmed
Normal user account, as long as the name and password is either the same as the account the application runs under, or you've impersonated the remote user account correctly, and it has correct access, it'll work.
Oskar Duveborn