"rumplestiltskin" <exapplerep@gmail.com> wrote in message
news:739d3b58-62ec-45af-83fe-3684a622f6a6@p22g2000pre.googlegroups.com...
> On Jul 11, 1:50 pm, "Pegasus [MVP]" <n...@microsoft.com> wrote:
>> "rumplestiltskin" <exapple...@gmail.com> wrote in message
>>
>> news:e8b35e47-bd61-4eb2-9149-bde680e8c6fc@v6g2000prd.googlegroups.com...
>>
>>
>>
>> > On Jul 11, 11:54 am, "Pegasus [MVP]" <n...@microsoft.com> wrote:
>> >> "rumplestiltskin" <exapple...@gmail.com> wrote in message
>>
>> >>news:fa46ef5b-87e0-46c0-93fb-b1078c3ecaa4@z8g2000yqz.googlegroups.com...
>>
>> >> > On Jul 11, 8:59 am, "Pegasus [MVP]" <n...@microsoft.com> wrote:
>> >> >> "rumplestiltskin" <exapple...@gmail.com> wrote in message
>>
>> >> >>news:819e5a76-b4fe-41f2-a216-77b4cac6cb39@z30g2000prg.googlegroups.com...
>>
>> >> >> > I want to be really clear about this problem because I've seen
>> >> >> > the
>> >> >> > same question posted elsewhere with 50 answers that have nothing
>> >> >> > to
>> >> >> > do
>> >> >> > with the question.
>>
>> >> >> > I am running a server that has a shared "users" folder. When a
>> >> >> > user
>> >> >> > (on an XP Pro machine) logs into the share, the user is asked
>> >> >> > his/her
>> >> >> > username and password. This is perfect. However, that username
>> >> >> > and
>> >> >> > password are stored until the user logs out or restarts the PC.
>> >> >> > As I
>> >> >> > have many users of that PC (it's in a classroom), I do NOT want
>> >> >> > the
>> >> >> > username and password stored when the user closes the window into
>> >> >> > that
>> >> >> > server share. The next user who wants to use that share should be
>> >> >> > able
>> >> >> > to enter his/her username and password WITHOUT having to logout
>> >> >> > of
>> >> >> > the
>> >> >> > PC or restart it.
>>
>> >> >> > On Mac clients, this is not a problem as there is a "disconnect"
>> >> >> > button that accomplishes this instantly. How do I make Windows
>> >> >> > forget
>> >> >> > the username and password as soon as the share window is closed?
>>
>> >> >> > Thanks.
>>
>> >> >> The general answer is: Put the following commands into the logon
>> >> >> script
>> >> >> (or
>> >> >> type them manually):
>> >> >> net use /persistent:no
>> >> >> net use * /del /yes
>>
>> >> >> Please note:
>> >> >> - Both commands are required just once but can be executed any
>> >> >> number
>> >> >> of
>> >> >> times.
>> >> >> - The settings are specific to each Windows logon account.
>>
>> >> > Pegasus,
>>
>> >> > Okay; your two commands seem to be the basis of what I need to do
>> >> > but
>> >> > it looks like it needs to be a batch file. I used Notepad, typed in
>> >> > those two lines, and saved the file as "logoff.bat". Then, when I
>> >> > double-clicked the file, you could see the Cmd window appear (and I
>> >> > think there's a command to make this appearance not happen, IIRC)
>> >> > and
>> >> > the next time someone tries to access that network share, the
>> >> > connection dialog appears. So this works.
>>
>> >> > Is there a way to add in one more iine of code to initiate the login
>> >> > again? What I mean by that is if some form of the "net use" command
>> >> > would, in essence, double-click on that network share and bring up
>> >> > the
>> >> > login dialog? I'll play with this but suggestions are welcomed.
>>
>> >> > Thanks.
>>
>> >> There sure is. Here is your complete batch file:
>> >> @echo off
>> >> net use S: \\ServerName\ShareName
>>
>> >> Remember - the other two commands are not required after you have run
>> >> them
>> >> once.
>>
>> > Before I saw your reply, I came up with this:
>>
>> > @echo off
>> > net use * /del /yes
>> > net use /persistent:no
>> > echo Just hit Enter key twice to cancel login.
>> > set /p user=User name:
>> > net use x: \\192.168.1.2\Users * "/user:%user%"
>>
>> > Are you saying that the first two "net use" commands in my batch file
>> > aren't necessary after they've been run once? Is that "per
>> > session" (from the time the machine starts up until it's turned off)?
>> > Or are they not necessary ever again after they've been run once?
>> > Wouldn't I have to use the "del" line after one user is finished with
>> > the share and the next user wanted to log in? They both have the same
>> > share but all users can get to that folder; it's the individual users'
>> > folders that reside inside the share and I assume that is why I need
>> > to unmount and then remount. It looks like if I don't procedurally
>> > unmount the share, it remains shared until I use the batch file to
>> > unmount it (them, if there are a number of mounts). Am I making sense
>> > here?
>>
>> > Thanks.
>>
>> When I said "just once" I mean "just once", full stop. But as I said,
>> both
>> commands must be run at least once *for every user*.
>>
>> Once persistency is turned off, existing share connections are deleted
>> when
>> the user logs off from his Windows session. Why don't you give it a try
>> to
>> see for yourself?
>>
>> The commands
>> echo Just hit Enter key twice to cancel login.
>> set /p user=User name:
>> net use x: \\192.168.1.2\Users * "/user:%user%"
>>
>> should probably be
>> echo Just hit the Enter key to cancel login.
>> set /p user=User name:
>> if "%User%"=="" goto :eof
>> net use x: \\192.168.1.2\Users * /user:"%user%"
>> Note the moved double quotes in the last line.
>>
>> While it is permissible to use IP addresses for the "net use" command, I
>> prefer NetBIOS names. They rarely if ever change.
>
> I'm using the IP because the server has a static IP so that's not an
> issue.
>
> You said "when the user logs off from his Windows session" and that's
> the problem: You may be thinking I'm using AD and we're not. Once the
> PC fires up and arrives at the Desktop, the user never logs off the
> session until the end of the day so I believe I have to use the "del"
> command (to remove any currently mounted volumes even though a window
> into that volume is closed). I would think the "persistent:no" command
> could be run only once (as you've suggested) but, as it has to run at
> least once (but it's okay to run more than once), I'll keep it in the
> batch file. If it's the first time logging into the the server for the
> day, then the "persistent:no" command is necessary even if the "del"
> command is not. Thereafter, the "del" command is necessary even if the
> first one is not.
>
> I think I'm good. Thanks for your help!
Yes, I think you've got it pretty well sorted out.