My HyperV-Host should connect to the shares provided by a virtual file server. Whenever I login to "early", the drives are not mapped, because the file-server-vm has not yet started.

The command I'm using in the logon script looks simple like this:

  net use s: \\file1.mydomain.local\share1 /PERSISTENT:NO

In this scenario, the share is not available on the network, so it is not mapped. Can I "force" a network drive mapping, even if the share is not (yet) available?

I could go with a persistent mapping ofc, but the shares change over time and I dont want to reconfigure each and every server, whenever a share becomes available.

is there something like a "force" option, or is it possible to distribute persistent network-drive-mappings via GPO?

  • You can't map a drive to a resource that doesn't exist; and when the server is down, that resource (the shared folder) doesn't exist. – Ƭᴇcʜιᴇ007 Jun 2 '14 at 17:52

You could use group policy preferences to map the drive, rather than a script. Group policy updates every 90mins (I think) by default so your drive should map...

or, you could group policy a scheduled task to check the drive is mapped and if not map it. Probably the easiest to implement with a small script.

  • Just checked on the GPO. Mapping is possible, but shows the same behaviour: Drive unavailable? -> Not Mapped. I think, that frequent checks if the share is available are possible - but not the best idea to start with. But Maybe the GPO along with a persistent share might work - worst case i have to wait {GPO_UPDATE_TIME} until persistent shares are created. – dognose Jun 2 '14 at 17:37
  • You need to do a regular check. Not too frequently or you will needlessly bog down the system. A scheduled task every 15-30-60 mins suffice? – Kinnectus Jun 2 '14 at 17:54

Following the idea of @Big Chris I did it the following way:

Created the Network-Share using a GPO Object with Reconnect and "Create" Action. (See here:

  • The Clients will now connect to any "new" networkshare, once the GPO is updated.
  • Due to the Reconnect Option they will not loose track of the share, even if it is not available while the client reboots.
  • If i permanently delete a network share, I will add a unmap command to the logon script until it is save to assume, that all clients have disconnected.
  • If i change a network share, I will modify the logon scriot to check if the volume name matches the "old" share in case I reuse that drive letter for a new share. Then I'll disconnect and let the GPO apply the new share.

The last 2 points are a bit of a workaround - but any other option than "create" will cause unmapped drives again, if they are temporary unavailable. (There is no way to decide whether a share is permantent or temporary unavailable ofc.)

Why I have choosen this solution over frequently checking for availability? Simple because with this option i can see, that a drive is mapped but not available - with the pulling-option i wouldn't know whether it's unavailable - or a simple error occured during mapping.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.