Lade...

Blog Banner

26 February 2015

Quicktip #2

map folders reliable in a windows network

Windows users working with shared folders know the problem, that sometimes the folders are actually there but marked with a red cross. Then you click on the marked folder and the connection is all the sudden there.

When you have some rendernodes this is a big problem, since you only want to start the machine and get a rendering done. But then textures in shared folders are not accessible and bad frames are the result. Also when you have some programs in Autostart that need immediate access after system boot to shared folders it is problematic and errors occur. The reason for those errors can be, that your system is already started, ready to go and trys to map the network folders. Unfortunately your network connection is not yet ready at that time.

The solution is a little script which waits for the connection and maps all needed folders after the connection is established. Here is our guide to get the script working:

Create a textfile and name it autostart.bat.
Make sure the option “Hide extensions for known file types” is deactivated. 
First you set the name of your server or nas 

set nas=Servername

Replace Servername with the name of the computer that is hosting the shared folders.
Now the script pings this server and only after it gets a response the script continues, otherwise it repeats with the ping process.

:REPEAT

echo Searching for NAS-Name: %nas%...

ping -n 1 %nas% | find "TTL"

if not errorlevel 1 goto OK

if errorlevel 1 goto REPEAT

Now the little message that gives feedback that everything is ok.

:OK

echo found nas %nas% , create shared folders...

Now you can map all your folders by using the option /persistent:no. Then everytime you start your computer a new shared folder will be generated. Doing it this way, you will never have an old shared folder with a red cross caused by a lacking connection. It is important that all current shared folders are disconnected when you use this script for the first time.

net use X:  \servernamefolder1 /persistent:no

net use Y:  \servernamefolder2  /persistent:no

Here is the complete final script:

@echo off

set nas=Servername

:REPEAT

echo Searching for NAS-Name: %nas%...

ping -n 1 %nas% | find "TTL"

if not errorlevel 1 goto OK

if errorlevel 1 goto REPEAT

 

:OK

echo found nas %nas% , create shared folders...

 

net use X: \servernamefolder1 /persistent:no

net use Y: \servernamefolder2 /persistent:no

Save it and put it in your autostart folder.

To test that the script works properly, pull out your network cable or shutdown the server and launch the script. Until you reactivate the connection, you should now get the following message: 

Searching for NAS-Name: Servername 

And of course, after the connection is established again all the mapped drives and folders should appear.

 

 

  • Marc / zoppo

    27 Feb 2015 - 17:58:17

    Versprochen und geliefert :)
    Vielen Dank!

    brock

    26 May 2015 - 03:15:43

    Great Tip! I have this same issue with my mapped IES lights. Thank for the help!
    Would you have any information on set up and pitfalls of dual Ethernet teaming using c4d vray DR? Also why the standalone CMD always “unloads” bitmaps from temp file? Im trying desperately to get my render boxes to kick in and contribute faster. Thanks in advance.

Due to spam comments will be published manually by a moderator.