• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1124
  • Last Modified:

Windows shares not available on local machine with network cable unplugged.

Has anyone else noticed that shares on a machine are not even available on the local machine if the network cable is unplugged?

We create a share (say c:\share) and map it to \\mylocalmachine\share

We can access this from the local machine using the unc \\mylocalmachine\share.
Unplug the network drive and we get the message "\\ymlocalmachine\share is not accessible. You might not have permission to use this network resource.. blah blah blah

Does anyone know how to make that work. I *had* assumed it would use the local loopback driver.
1 Solution
Just a guess, but does it have to do with DisableDHCPMediaSense? If you pull the network cable XP/Wk3 will disable the network and the nic driver so it stops trying to communicate with the domain (if your on one) and thus will turn off file/print sharing service that is running on the network card.

other option would be if your a member of the domain and trying to give access to domain users instead of local users, thus not being able to authenticate the domain users when the cable is pulled.

Would lean heavier toward option 1 though...

2 options off the top of my head...
tjsbbiAuthor Commented:
Well the computer is actually using a static ip address. However I tested this with a DHCP setup but it doesn't work. The share still becomes unavailable when the cable is unplugged.

We are not using any domain users.

What we are trying to do is have the application continue to work for a local user of that machine when it is unplugged from the network. We are using a share name because when it *is* connected to the network users on different machines connect using the share. And the software is configured with a well-known share name.
It sound like a drive mapping persistence issue.  You can force the share to always be there by using this vbs login script.

Dim WSHNetwork, objNetwork, clDrives, boolPersistent
Set objNetwork = WScript.CreateObject("WScript.Network")
Set WSHNetwork = WScript.CreateObject("WScript.Network")
boolPersistent = True ' True = Persistent ; False = Not Persistent

On Error Resume Next
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i), True, True

'Map all drives
objNetwork.MapNetworkDrive "H:", "\\mylocalcomputer\share", boolPersistent
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

tjsbbiAuthor Commented:
This is an interesting script however the issue is that \\mylocalcomputer\share is not accessible when the network cable is unplugged. (Even though the share is on this computer).

We aren't really trying to map a logical drive but if we *were* then this script will fail because \\mylocalcomputer\share cannot be reached if the network cable is unplugged.

Really it looks like the problem is similar to Isigow: suggestion of DisableDHCPMediaSense. Windows detects that the network cable is unplugged and denies requests that require the network stack (even though localhost is still there).
Sorry about that, thanks for the clarification.
tjsbbiAuthor Commented:
Ok. We've found a solution.
It seems that the loopback is *not* installed. I had incorrectly assumed that the functionality was based on the loopback driver.
So I installed the loopbackdriver and left it to dhcp (the default). When there's no network it allocates a local 169.254.xxx.xxx number. The network shares are then all still available when the computer is not connected to a network.

Thanks to everyone
PAQed with points refunded (500)

EE Admin
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now