Question

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

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

-Authenticating with \xx.xx.xx.xxx -Authentication complete -Stopping service -Error: Access Denied

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

Update:

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.

Was it helpful?

Solution 2

I've disabled UAC and now it seems to work.

OTHER TIPS

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:

C:\> net use \\xx.xx.xx.xx\ipc$ * /user:username

The * tells it to prompt you for the password.

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).

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)?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top