<p>I'm having an amazing amount of trouble starting and stopping a service on my remote server from my msbuild script.</p>

<p>SC.EXE and the ServiceController MSBuild task don't provide switches to allow a username/password so they won't authenticate, so I'm using RemoteService.exe from www.intelliadmin.com</p>

<p>-Authenticating with \xx.xx.xx.xxx
-Authentication complete
-Stopping service
-Error: Access Denied</p>

<p>The user account details I'm specifying are for a local admin on the server, so whats up?! I'm tearing my hair out!</p>

<h3>Update:</h3>

<p>OK here's a bit more background. I have an an XP machine in the office running the CI server. The build script connects a VPN to the datacentre, where I have a Server 2008 machine. Neither of them are on a domain.</p>

[{'answer_id': 25292, 'author': 'John Smithers', 'author_id': 1069, 'author_profile': 'https://Stackoverflow.com/users/1069', 'pm_score': 0, 'selected': False, 'text': '<p>If I understand your scenario correctly, it could help running the script with a domain account which is administrator on your remote machine (or better: has the right to start and stop the service).</p>\n'}, {'answer_id': 25325, 'author': 'HenningK', 'author_id': 2741, 'author_profile': 'https://Stackoverflow.com/users/2741', 'pm_score': 0, 'selected': False, 'text': '<p>Quick followup question - can you use the "runas" command from an MSBuild script? If so, wouldn\'t you be able to simply impersonate another user with runas /user:dsfsdf /password:dfdf sc.exe ... (or similiar - I haven\'t researched the command-line options)?</p>\n'}, {'answer_id': 25326, 'author': 'Brad Wilson', 'author_id': 1554, 'author_profile': 'https://Stackoverflow.com/users/1554', 'pm_score': 3, 'selected': False, 'text': '<p>Often, you can connect to the IPC$ "pseudo-share" on the machine to help establish the credentials before running commands like SC.EXE. Use a command like:</p>\n\n<pre><code>C:\\&gt; net use \\\\xx.xx.xx.xx\\ipc$ * /user:username\n</code></pre>\n\n<p>The <code>*</code> tells it to prompt you for the password.</p>\n'}, {'answer_id': 56473, 'author': 'mcintyre321', 'author_id': 2086, 'author_profile': 'https://Stackoverflow.com/users/2086', 'pm_score': 2, 'selected': True, 'text': "<p>I've disabled UAC and now it seems to work.</p>\n"}]
['https://Stackoverflow.com/questions/25269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2086/']