Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Start a remote service from SQL??

Author  Topic 

mangalau
Starting Member

11 Posts

Posted - 2012-05-04 : 16:17:08
I wanna start a service on a remote machine. I use
exec..xp_cmdshell 'sc \\remotemachine start messenger'
From cmd on windows it works, from SQL it doesn't.
The SQL account is a member of a domain admin.
I tried to create a new SQL user a grant him acces to xp_cmdshell
i stil get an error Error 5: Access is Denied.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-05-04 : 17:10:13
What account are you using for the SQL Server service? That's the account that needs the access, not the person who is logged into the query window.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2012-05-05 : 15:18:37
First your account by which you invoke xp_cmdshell needs to be a member of sysadmin fixed role.If that's true then the xp_cmdshell will execute under the security context of the account under which sql server service is running.

After Monday and Tuesday even the calendar says W T F ....
Go to Top of Page
   

- Advertisement -