HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to map another server through SQL Server Management Studio

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
studiomaphowsqlmanagementanotherthroughserver

Problem

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.

Solution

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'

Context

StackExchange Database Administrators Q#27576, answer score: 8

Revisions (0)

No revisions yet.