# shared folder gets unshared???



## dojharris (Jul 27, 2006)

Hi i got a shared folder on a external drive. The problem is when i turn the external hard drive off or restart my computer it is no longer shared and i have to set it to be shared again. I have other shared folders on the computer but they stay shared, how can i make the one on the external hard drive stayed shared.,,,,, Running XP Pro. Thanks for you time Doj Harris


----------



## smz (Mar 12, 2007)

it's a removable drive... windows is designed by default to do this... you neverk now when you may pull the drive and invalidate the share and very well may turn it back on another time and it will appear as a different drive letter. I bet there is a workaround for it but this is the behavior I've experienced since day one.


----------



## RedYeti (Nov 16, 2007)

Solved this with a little batch file and a download of a little file from MS.

First you'll need RMTSHARE.EXE from MS. This can be found inside the RMTSHAR.exe self extractor (note there's no last "E") from this link:

ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt40/i386/

(Which I found here: http://support.microsoft.com/kb/172599 but failing that google for 'file: RMTSHARE.EXE' without the quotes)

Run that, take the resulting RMTSHARE.EXE and place it wherever you like, for example in C:\Scripts

Create a batch file in the same directory (rename a text file) with this in it (edited to suit as below)

RMTSHARE.EXE \\yourComputerName\"shareNameYouWant"="driveLetter:\directoryName" /UNLIMITED

Where:

yourComputerName is the name of the machine (in a command window type ipconfig /all and use entry for "Host Name") - e.g. desktop

shareNameYouWant for example LaptopBackup

driveLetter is the letter that your removeable drive mounts up as e.g. E

directoryName is the name of the directory you wish to share e.g. LaptopBackup

So putting that all together it looks like this

RMTSHARE.EXE \\desktop\"LaptopBackup"="E:\LaptopBackup" /UNLIMITED

Create a shortcut to that batch file in your startup folder.

Sorted!


----------



## RedYeti (Nov 16, 2007)

If you really want to get clever here's a batch file that will handle plugging in several different drives as your external drive and even give you a second chance to do so.

The batch file looks for each of the external drives, if it finds none it pauses, asks you to plug one in, and tries one more time.

There are three points to edit, two sections for drive letters and one for the final command, all with a comment starting "edit this section" above them


@echo off
:: Mounts shared folders on external drives (since Windows XP won't preserve those across logins)
:: RedYeti - 16 Nov 2007

:: unset in case it's been run already in this cmd shell
set TARGET_EXT_HD_LETTER=


:: *****> start section to set external drive letter (must be repeated later) <*****

:: edit this section to add or remove external drive letters
if exist E:\ set TARGET_EXT_HD_LETTER=E:\
if exist M:\ set TARGET_EXT_HD_LETTER=M:\
if exist N:\ set TARGET_EXT_HD_LETTER=N:\

:: *****> end section set external drive letter <*****


if "%TARGET_EXT_HD_LETTER%"=="" echo.
if "%TARGET_EXT_HD_LETTER%"=="" echo No external drive found - plug one in and one more attempt will be made
if "%TARGET_EXT_HD_LETTER%"=="" echo.
if "%TARGET_EXT_HD_LETTER%"=="" pause


:: *****> start repeat of section to set external drive letter <*****

:: edit this section to add or remove external drive letters
if exist E:\ set TARGET_EXT_HD_LETTER=E:\
if exist M:\ set TARGET_EXT_HD_LETTER=M:\
if exist N:\ set TARGET_EXT_HD_LETTER=N:\

:: *****> end repeat of section to set external drive letter <*****


if "%TARGET_EXT_HD_LETTER%"=="" echo.
if "%TARGET_EXT_HD_LETTER%"=="" echo Still no external drive found - you need to run this again
if "%TARGET_EXT_HD_LETTER%"=="" echo.
if "%TARGET_EXT_HD_LETTER%"=="" pause
if "%TARGET_EXT_HD_LETTER%"=="" exit

:: edit this section!
:: if we reached here, pull back the curtain and mount the share
@echo on
RMTSHARE.EXE \\yourComputerNameHere\"shareNameYouWantHere"="driveLetter:\directoryName" /UNLIMITED


----------



## dojharris (Jul 27, 2006)

Hi again
Back to shared folders, lol, i know its a long time, but, i don’t think i followed any of the 2 post given, but not 100%
If i did follow the instructions given is there a way to check if i did or didn’t.
My shared folders do stayed shared now and was wondering what i did so i can try to keep to the same method so i can get it in my head and remember.
I also set something else up on my PC and was wondering if this kept my folders shared. I setup Internet Information Server "IIS web server"
Thanks for your time again doj harris


----------



## RedYeti (Nov 16, 2007)

There aren't two suggestions above.


smz said it can't be done.

I showed how it can be done (via a workaround).

I then posted a batch file that wraps up that workaround into something a bit smarter.

Look in your startup folder. If there's a shortcut to a batch file containing my workaround...

As for IIS - I don't know much about it. It may have some feature that would allow this but to be honest I'd doubt it very much.

I've been using the above batch file every day since I first posted it just under a year ago and it's worked flawlessly.


----------



## Hertz2P (Nov 23, 2004)

How about under a 64 bit system with the same issues? Running Vista ultimate 64 here, and my music and movies are on external drives that keep getting unshared. rmtshare.exe says that it only works on 32 bit OS's.

Thanks


----------



## RedYeti (Nov 16, 2007)

I haven't got Vista or 64 bit OS (my new machine came with both - I had it dropped back to 32 bit XP - too much bother that way lay).

So all I can suggest is that Vista is probably capable of giving a 32 bit app a 32 bit shell to run inside (leaving the app blissfully unware it's really running in a 64 bit shell).

Have a poke around on the net and post back here if you crack it!


----------



## Engineer1 (May 28, 2009)

It's a long time for this thread, but I just came across it and thought maybe others might be interested in what I recently discovered.

I had similar problems with shares "disappearing" in WinXp Pro 32-bit for an external Firewire 800 drive. Sometimes they were there, and sometimes they weren't! They worked for months (> 1 year), then just stopped working one day, only to reappear another day.

After much experimenting, here's what I've concluded. I believe this works for any USB or Firewire external drive but am not 100% sure. All bets are off for eSATA drives because it is a different interface that logically looks like an internal drive even though it is physically external.

First, assign a fixed drive letter using the Disk Manager:

Make sure your external disk is powered up and recognized by WinXP with a drive letter.
 Start->My Computer->Manage->Computer Management->Storage->Disk Management
 Right-click the correct drive partition in the lower right corner of the window to get the "Change Drive letter and Paths..." menu.
 Select a fixed drive letter and exit the menu.
Now your external drive will always show up with the same drive letter when attached.

Now create any shares you want on the drive.

Here is the observed behavior with a fixed drive letter. I don't think this behavior can be changed, but understanding it may allow you to accomplish your tasks.


WinXP appears to save a "static" list of shares for all drives.
External drive shares are added to this list whenever they are manually created (or deleted).


At boot time, WinXP appears to create a boot-instance-specific "dynamic" list of shares.
It does this by checking all drives it sees at boot time against the static list.
If it finds drives with shares in the static list, it adds the shares to the dynamic share list.


If an external drive is not attached at boot time, it's shares will not be added to the dynamic list.


Once the dynamic list is created, WinXP then creates all the shares in the list.


The dynamic list is the same list shown in:
Start->My Computer->Manage->Computer Management->System Tools->Shared Folders->Shares​

If an external drive is later removed, its shares remain in the dynamic list.
This list is dynamic in the sense that it may be different on every reboot but remains fixed until the next reboot.


If an external drive is later connected, only its shares on the dynamic list are created.
Any shares on the static list are ignored and not created.


The static list appears only to be used at boot time to create the dynamic list.
I am not aware of any way to "refresh" the dynamic list after boot time.


Logging on or off does not re-create, update, or otherwise affect the dynamic list.
Only booting seems to do that.


I haven't experimentally thoroughly with this, but manual changes to external drive shares appear to update both the static and dynamic lists. For a drive not present at boot time, the static list's share info will still be overwritten by creating a new share manually. This will thus be effective on future reboots.
Here are some consequences of this behavior:


If attached at boot time, the drive can later be disconnected any number of times and all its shares will be remembered (recreated) every time it is reconnected.

If not connected at boot time, none of the drive's shares will ever be remembered (recreated), regardless of how many times the drive is disconnected and reconnected thereafter until the next reboot.

If not connected at boot time, the drive's "forgotten" shares may be restored simply by rebooting with the external drive attached at boot time.
If you can conform to these rules, your shares will always be recreated automatically.

It would be nice to be able to refresh the dynamic list after boot time. If anyone finds a way to do this, please post the procedure.

Regards,
Engineer1


----------



## thosecars82 (Oct 12, 2008)

I have this problem with win xp pro in a laptop.
Whenever I create a share on any folder in the laptop's hard disk or in the laptop's cdrom drive it lasts just a few seconds, around 10-30 seconds because after that time, the share no longer appears on the screen mentioned "Start->My Computer->Manage->Computer Management->System Tools->Shared Folders->Shares".
What I do know is that this behaviour happens with and without windows firewall enabled.( I do not use any other firewall)
Moreover, this behaviour just happens when I have the wireless antena enabled. If I share this folder when the laptop is in a peer to peer local network then the folder does not get unshared. 
This problem I am mentioning is a mess because it forces me to use a cable peer to peer link whenever I want to transfer files in the local network many times that I would prefer to use wireless.
Thanks in advance for your suggestions.


----------



## stm76 (Aug 18, 2010)

RedYeti said:


> Solved this with a little batch file and a download of a little file from MS.
> 
> First you'll need RMTSHARE.EXE from MS. This can be found inside the RMTSHAR.exe self extractor (note there's no last "E") from this link:
> 
> ...


I just wanted to say that this suggestion works perfectly. We swap out an external hard drive daily for backups and every time it gets swapped out, the share doesn't show up on the other plugged in hard drive. (Both use the same drive letter as only one is connected at any given time and they have identical folder structure). So, I set the batch file to run daily after the drives have been swapped. It re-creates the share which makes it available to other computers on the network to push backups to it.

Thanks a bunch.


----------

