I finally bought a networkdrive to be used in my home network. My wife was complaining that all pictures were on the pc downstairs (my shackcomputer) and she want to see them also on the pc in the living room. Time to share the data. But I needed a NAS style disk, not just some usb drive.
While I was visiting a giant store for looking a DVD for the kids I noticed the Lacie Network Space 2 drive. 1 Terrabyte with user control and FTP. Just what I needed. Quickly bought one and went home. Configuration is done via the webinterface and works pretty good. It also have a dyndns client build in, yes yes, finally I can uninstall the dyndns updater client from my computer.
At first I copied all data to the “OpenShare” folder. But I learned that this folder is wide open and everyone could acces it via anonymous ftp. Not a good idea. Created a user for my wife and moved the data.
I used the Windows XP map drive function to map the home folder to the Z: driveletter. But it kept asking for the user, even if I mapped it with a different user. Time to figure out something else.
A script to map the drive every time the computer is started. I played with net use and came up with this :
net use y: \\192.168.1.2\home password /user:username
net use z: \\192.168.1.2\OpenShare
I made a bat file with these lines and placed it in my startup folder (typical c:\documents and settings\user\Start Menu\Programs\Startup)
After a reboot the connect.bat file showed a big error on the screen. What happened ? The computer is wireless linked to the router. And the connection is made after some time. I’m using a wireless usb stick or is it a wifi usb stick ? The connectionsoftware is also loaded from the startupfolder and needs some time to build the connection to the router. In the meantime, my batch file will try to map the drive letters. It doesn’t work this way.
The solution : wait until the connection is made and then map the drives. Ok how will I do that ?
With some vbscript I’ll loop until a valid ping is made to the ip address of the network drive. VBscript is relative easy and I use that for the time being for the logonscripts on my qrl. The most Windows computers can execute the script via wscript.exe or cscript.exe. I will not go further in detail about that.
This is the script (saved to mapdrives.vbs) :
Dim objNetwork, objShell, objFSO, strComputer
Set objNetwork = WScript.CreateObject(“WScript.Network”)
Dim objShell, boolCode
Set objShell = CreateObject(“WScript.Shell”)
boolCode = objShell.Run(“Ping -n 1 -w 300 ” & strComputer, 0, True)
If boolCode = 0 Then
Ping = True
Ping = False
Do Until Ping(“192.168.1.2”)
On Error Resume Next
objNetwork.MapNetworkDrive “Y:”, “\\192.168.1.2\home”,true, “username”, “password”
objNetwork.MapNetworkDrive “Z:”, “\\192.168.1.2\OpenShare”
The ping routine is not made by me, found it somewhere on the net. It uses the the ping.exe from the os. If a valid ping is received, the Do Loop is exited and the rest of the script is executed. The line “On Error Resume Next” is not nice coding, but who cares in this case.
I placed the script somewhere on my pc and modified the batchfile in the startupfolder.
Now everything seems to work the way I like it.