Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Posts
    492

    Unanswered: Weird behaviour on net use

    When I run the command:
    exec master..xp_cmdshell 'NET USE'
    from the analyzer the box responds there are no entries in the list.

    After that, I run the command:
    exec master..xp_cmdshell 'NET USE Z: /DELETE'
    after which the box responds with a "network connection could not be found."
    and that's all okay.

    The weird thing is:
    exec master..xp_cmdshell 'NET USE Z: \\MACHINE\SHARENAME'
    results in a "The local device name is already in use.".

    The machine in this particular case is the box itself. I have no problem accessing other disks on other systems. I can see the share using the view command. There's no maximum on the share itself and I can connect to the share using another sql box with the same user.

    I don't know why it won't budge, worked before like a charm. After six months or so it just stopped. Anyone seen/solved this behaviour?

    thanx,

  2. #2
    Join Date
    Jun 2009
    Posts
    3
    Hello Kaiowas,

    do you remember if you ever found a solution to this problem?
    I'm having the EXACT same problem and can't for my life figure out what is wrong...

    I know that this is an old thread but hopefully you still remember!

    Best Regards
    Dempen

  3. #3
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    If you type the same commands in a command prompt do you get the same results ?

  4. #4
    Join Date
    Jun 2009
    Posts
    3
    Hi PMASchmed and thanks for your reply,

    In the command prompt the drive actually shows up but it has the status 'Unavailable'. It is also possible to /DELETE the drive in the command prompt but this doesn't change anything for my script. I can then map the drive again in command prompt but it shows up with the status 'Unavailable' again.

    In xp_cmdshell I get the following replies:
    exec master..xp_cmdshell 'NET USE'
    'There are no entries in the list.'

    exec master..xp_cmdshell 'NET USE Y: /DELETE'
    'The network connection could not be found.'

    exec master..xp_cmdshell 'NET USE Y: \\MACHINE\SHARENAME <password> /USER:<user>'
    'System error 85 has occurred. The local device name is already in use.'

    I find this very strange since I was convinced that the script is run by the same service account as I am using, when connecting to the server.

  5. #5
    Join Date
    Jun 2009
    Posts
    3
    FYI, I can tell you that my script worked fine for a while and then all of a sudden stopped working. I tried to solve the problem in several ways without succeding and then changed the Drive letter from X to Y. Then everything was working again and has worked until a few days ago when it stopped working again. I am 99% sure that another drive letter change (perhaps back to X) would solve the problem once again, but I would like to find a permament solution to the problem.

    Unfortunately I have not been able to identify any "common denominator" (?) for the occassions, that could be a possible solution to the problem. Perhaps it has something to do with a server restart or something of that kind, that causes the mapping to be locked in some way, but like I said I have been able to find anything that points in that direction.

  6. #6
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    What account is starting the SQL agent ? Are you running the commands with a SQL or Domain/Trusted Account ? Check drive mappings for each (if using SQL Account, will use Agent permissions, assuming that is started with domain account), I believe to get around this you can setup a proxy account in SQL (which will use a domain account).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •