?
Solved

run WMIC from query analyzer, acess denied!

Posted on 2005-04-07
4
Medium Priority
?
908 Views
Last Modified: 2008-02-01
I tried to run the following sql statement from Query Analyzer,

***************************************************************
EXEC master.dbo.xp_cmdshell 'wmic /node:zid3159 service where (name=''JRun Default'') set state=''Running'''
***************************************************************

get following error:

***************************************************************
ERROR:
Code = 0x80041003
Description = Access denied
Facility = WMI
NULL
***************************************************************

but it works fine if run the following command-line directly:
***************************************************************
wmic /node:zid3159 service where (name='JRun Default') get state
***************************************************************


WHY?????????????????????????????????
0
Comment
Question by:DataField
  • 3
4 Comments
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 13733465
xp_cmdshell runs under either:

1. SQL Server service account (if your SQL login is a sysadm)
2. Proxy account (if your SQL Server login is not sysadm)


Whichever user you are doesn't have permission to run WMIC


Look up Books online for more info.





0
 

Author Comment

by:DataField
ID: 13737781
I user my windows login to logon server (windows 2003) remotely, it is ok I execute it from command prompt. But it doesn't work if I run from query analyzer.


0
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 750 total points
ID: 13741490
Yes.

You are running your statements under two different users. Thats why it only works one way.

If you temporarily change the SQL Server Service to domain admin it will work through query analyzer.



But don't leave the SQL Server Service user as domain admin. Its a security issue.

0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 13758583
Just want to let you know, you want to work the minimum security required for this account, rather than leave it at Administrator.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Exchange database can often fail to mount thereby halting the work of all users connected to it. Finding out why database isn’t mounting is crucial and getting the server back online. Stellar Phoenix Mailbox Exchange Recovery is a champion product t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question