{"id":847,"date":"2010-06-28T15:34:18","date_gmt":"2010-06-28T12:34:18","guid":{"rendered":"http:\/\/neosmart.net\/blog\/?p=847"},"modified":"2013-08-26T18:19:06","modified_gmt":"2013-08-26T23:19:06","slug":"the-woes-of-windows-vista7-mapped-network-drives","status":"publish","type":"post","link":"https:\/\/neosmart.net\/blog\/the-woes-of-windows-vista7-mapped-network-drives\/","title":{"rendered":"The Woes of Windows Vista\/7 Mapped Network Drives"},"content":{"rendered":"<p>One of the biggest, bestest, and most-hyped features of Windows Vista (according to Microsoft, that is) was the <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/bb878108.aspx\" rel=\"follow\">brand spanking new TCP\/IP networking stack<\/a>. Ask us, it sucks. Network performance hasn&#8217;t improved any over the ancient stack used in XP (nor should it &#8211; it&#8217;s not like there&#8217;s anything <em>new<\/em> in IPv4) though it does add better IPv6 support out-of-the-box and ships with some even more functionality in Windows 7. But more importantly, Microsoft threw out decades of testing and quality assurance work on the existing Networking Stack and replaced it with something rather questionable.<\/p>\n<p>We&#8217;ll be following up some more on this topic from a technical side later in another article, but for now, an example that most of you are sure to have come across if you&#8217;ve ever tried to map network drives before:<\/p>\n<p><img class=\"colorbox-847\"  loading=\"lazy\" decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/4741620397_828e1a22f6.jpg\" alt=\"\" width=\"410\" height=\"97\" \/><\/p>\n<p>This popup is shown at system startup if you have any mapped network drives to UNC shares which are not protected with a username and password. If you map a network destination that <em>does<\/em> require authentication, Windows will map the drive OK. To further complicate matters: this message is shown <em>only when you startup from a cold boot!<\/em> If you restart your PC (vs shutdown and powerup), it won&#8217;t appear.<\/p>\n<p>Resolving the issue is straight-forward enough: just double-click on the network drive in My Computer and it&#8217;ll automatically, instantly, and silently connect. Which makes one wonder why Windows couldn&#8217;t connect in the first place.<\/p>\n<p>Good question.<\/p>\n<p><!--more--><\/p>\n<p>While working an update to <a href=\"http:\/\/www.genie9.com\/Business\/genie_timeline_pro\/overview.aspx\" rel=\"follow\">Genie Timeline<\/a>, I ran across this issue. Windows wouldn&#8217;t connect a mapped network destination at startup for some of our customers, meaning that our backup couldn&#8217;t continue (assuming you&#8217;re backing up to the network drive) until you manually intervened and opened the mapped drive yourself. Definitely not cool.<\/p>\n<p>As an in-house R&amp;D test, we attempted to manually re-establish the connection via the command-line. By running<\/p>\n<pre>net use Z: \\\\remote\\path\\<\/pre>\n<p>we were able to re-establish the &#8220;disconnected&#8221; network drive. But when we tried to implement this in code, we came across a funny issue. If you try to run this<em> <strong>very early on<\/strong><span style=\"font-style: normal;\"> during the logon procedure, it will fail with error code ERROR_FILE_NOT_FOUND &#8211; basically, it&#8217;s unable to contact the network path. The funny thing is, explicitly testing to see if we can connect to the network path [GetFileAttributes(networkPath)] doesn&#8217;t return any error. But Windows itself is unable to establish a connection. Using &#8216;net&#8217; from the commandline was just a workaround for R&amp;D purposes, so we turned to the trusty old <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa385413(VS.85).aspx\" rel=\"follow\">WNetAddConnection2<\/a> function &#8211; and it too failed with ERROR_FILE_NOT_FOUND even though the network path both definitely existed and was perfectly accessible as a UNC location!<\/span><\/em><\/p>\n<p><strong>Attempting either of these techniques to establish a mapped network drive connection later on &#8211; say 2 or 3 minutes after logon &#8211; works just fine. As does attempting to establish a connection to a UNC path that requires authentication. Or attempting to connect to the network drive after a restart and not a cold boot.<\/strong><\/p>\n<p>In the end, we resorted to calling WNetAddConnection2 at timed intervals after startup if the UNC path is accessible and the mapped network drive is not. It got the job done, but it really does speak volumes when developers have to run through hoops to address issues that have been out 2 OS releases and 5 years ago. We have no such problems with Windows XP.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the biggest, bestest, and most-hyped features of Windows Vista (according to Microsoft, that is) was the brand spanking new TCP\/IP networking stack. Ask us, it sucks. Network performance hasn&#8217;t improved any over the ancient stack used in XP &hellip; <a href=\"https:\/\/neosmart.net\/blog\/the-woes-of-windows-vista7-mapped-network-drives\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":505,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[731,22,57,11,694,4,620,312,395],"class_list":["post-847","post","type-post","status-publish","format-standard","hentry","category-software","tag-mapped-network-drives","tag-microsoft","tag-networking","tag-programming","tag-win32","tag-windows","tag-windows-7","tag-windows-vista","tag-windows-xp"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4xDa-dF","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/posts\/847","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/users\/505"}],"replies":[{"embeddable":true,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/comments?post=847"}],"version-history":[{"count":1,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/posts\/847\/revisions"}],"predecessor-version":[{"id":2603,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/posts\/847\/revisions\/2603"}],"wp:attachment":[{"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/media?parent=847"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/categories?post=847"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/tags?post=847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}