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 2008 Forums
 Transact-SQL (2008)
 xp_cmdshell 'Net Use'

Author  Topic 

psclroy
Starting Member

3 Posts

Posted - 2012-02-23 : 11:57:19
Hi,
I have the following chunk of script in a stored proc which is ran by TimeManagerUser with execute privileges that only works when executed by a user that has sysadmin privileges.

Even though TimeManagerUser is in Master and has execute privileges on xp_cmdshell and have the proxy account of User1 through the command

'EXEC sp_xp_cmdshell_proxy_account 'irb-cisr\User1', 'Password1'',

it still says it mapped the drive successfully but in reality it did not.

Here's the text.

EXEC master..xp_cmdshell 'NET USE s: \\Server03\Translation Password1 /USER:uuu-aaa\User1'

EXEC master..xp_cmdshell 'NET USE t: \\DEVSer25\Completed Password1 /USER:uuu-aaa\User1'

EXEC master..xp_cmdshell 'Move /Y t:\draft\*.* s:\draft\TestingDEV'
EXEC master..xp_cmdshell 'Move /Y t:\decisions\*.* s:\Decisions\TestingDEV'

Any has an idea why it's not working?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-02-23 : 12:25:35
Doesn't it map it to the SQL Server session and not the session you are under? So if you logged in with the service account, you would see the drive mappings.

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

Subscribe to my blog
Go to Top of Page

psclroy
Starting Member

3 Posts

Posted - 2012-02-23 : 13:42:00
You are right, if I use the service account outside the SQL session it will work.

But under the SQL session with the TimeManagerUser it doesn't work in SQL 2008.

It did in SQL 2000 though.
Go to Top of Page

psclroy
Starting Member

3 Posts

Posted - 2012-02-24 : 08:29:03
Anyone else has an idea to help me?
Go to Top of Page
   

- Advertisement -