Sql-server – How to map another server through SQL Server Management Studio

sql serversql-server-2008ssmst-sql

I am trying to map another server by giving the command

EXEC xp_cmdshell 
    'NET USE H:\\568.256.8.358\backup_147 1234abc /USER:cranew /PERSISTENT:yes'

I got an error with this:

network path not found

But I am able to map another server manually. Please help me in sorting this out.

Best Answer

This is more of a NET USE question than a SSMS/SQL Server question.

NET USE has the syntax:

net use [{DeviceName | *}] 
   [\\\\ComputerName\ShareName[\volume]] [{Password | *}]] 
   [/user:[DomainName\]UserName] [/user:[DottedDomainName\]UserName] 
   [/user: [UserName@DottedDomainName] [/savecred] [/smartcard] 
   [{/delete | /persistent:{yes | no}}]

So, I would expect your command to look like this:

EXEC xp_cmdshell 
    'NET USE H: \\568.256.8.358\backup_147 1234abc /USER:cranew /PERSISTENT:yes'