Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xp_cmdshell 'NET LOCALGROUP' Error

Status
Not open for further replies.

Bob1129

Programmer
May 26, 2002
3
US
I get an error when I run

master..xp_cmdshell 'NET LOCALGROUP'

The error is:
System error 1312 has occurred.
A specified logon session does not exist. It may already have been terminated.

NET LOCALGROUP will run from the command window.

I can run
master..xp_cmdshell 'NET USER'

and it works fine.

I logon as administrator using Windows authentication. Administrator is a member of the System Administrators server role and is a db owner.

Any suggestions?

Bob
 
I belive that xp_cmdshell will not use the permissions/logon of the user that you are logged on as. Could this be the cause of the problem?

See books online xp_cmdshell for more detail, here is a snippit:

When you grant execute permissions to users, the users can execute any operating-system command at the Microsoft Windows NT® command shell that the account running Microsoft SQL Server™ has the needed privileges to execute.

By default, only members of the sysadmin fixed server role can execute this extended stored procedure. You may, however, grant other users permission to execute this stored procedure.

When xp_cmdshell is invoked by a user who is a member of the sysadmin fixed server role, xp_cmdshell will be executed under the security context in which the SQL Server service is running. When the user is not a member of the sysadmin group, xp_cmdshell will impersonate the SQL Server Agent proxy account, which is specified using xp_sqlagent_proxy_account. If the proxy account is not available, xp_cmdshell will fail. This is true only for Microsoft® Windows NT® 4.0 and Windows 2000. On Windows 9.x, there is no impersonation and xp_cmdshell is always executed under the security context of the Windows 9.x user who started SQL Server.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top