[Samba] windows /bat script question

2005-03-09 Thread Alexander Lazarevich
Subject isn't exactly samba, but samba people usually know a lot about 
windows bat scripting. Here's my problem:

Currently our domain login script is doing this (among other things):
ifmember.exe WINDOWS-DOMAIN\Projects
if errorlevel 1 ( net use p: \\server1\projects )
This works fine. The problem is I'm moving the projects storage to a 
different server called server 2 (which is linux running samba 3, so it 
is samba related somewhat). The logic I need is:

If p: is on server 1, remove the persistant share \\server1\projects, then 
if p: does not exist, create a persistant share p: \\server2\projects.

Sounds easy enough, but I have no idea how to test if a share is on a 
particular remote server. I'm trying if exist \\server1\projects, but 
that doesn't work the way I want it as scripts seem to only understand the 
local drive letter names, not the remote names. I could try to spit out 
the contents of net use p: to a file, then parse out the remote name 
string, and compare that, but that seems like a hard way to accomplish it 
and I don't want the script parsing out stuff during a login. There's got 
to be an easier way.

I could also just always remove the p:, then mount it from server2. But 
that adds an extra /delete every single time someone logs on, I'd prefer 
not to do that. I only want to /delete p: if p: is remote server1, not if 
it's remote server 2.

Anyone have an idea?
Thanks in advance,
Alex
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


RE: [Samba] windows /bat script question

2005-03-09 Thread Nathan Vidican
You could always create an empty txt file, set it to read only on server1,
and test in your batch script if the file exists; if esists then re-map,
else just map to server 2... If the file doesn't exist, then it's either
already mapped to server2 (cause' the file only resides on server1), or
there even isn't anything mapped to p:, then it will fix your problem...

Sure there's other ways, but this would seem simplest to me; again only my
two cents here, try it else see what anyone else comes up with for you.


--
Nathan Vidican
[EMAIL PROTECTED]
Windsor Match Plate  Tool Ltd.
http://www.wmplt.com/

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Alexander Lazarevich
Sent: Wednesday, March 09, 2005 11:51 AM
To: samba@lists.samba.org
Subject: [Samba] windows /bat script question


Subject isn't exactly samba, but samba people usually know a lot about
windows bat scripting. Here's my problem:

Currently our domain login script is doing this (among other things):

ifmember.exe WINDOWS-DOMAIN\Projects
if errorlevel 1 ( net use p: \\server1\projects )

This works fine. The problem is I'm moving the projects storage to a
different server called server 2 (which is linux running samba 3, so it
is samba related somewhat). The logic I need is:

If p: is on server 1, remove the persistant share \\server1\projects, then
if p: does not exist, create a persistant share p: \\server2\projects.

Sounds easy enough, but I have no idea how to test if a share is on a
particular remote server. I'm trying if exist \\server1\projects, but
that doesn't work the way I want it as scripts seem to only understand the
local drive letter names, not the remote names. I could try to spit out
the contents of net use p: to a file, then parse out the remote name
string, and compare that, but that seems like a hard way to accomplish it
and I don't want the script parsing out stuff during a login. There's got
to be an easier way.

I could also just always remove the p:, then mount it from server2. But
that adds an extra /delete every single time someone logs on, I'd prefer
not to do that. I only want to /delete p: if p: is remote server1, not if
it's remote server 2.

Anyone have an idea?

Thanks in advance,

Alex
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


RE: [Samba] windows /bat script question

2005-03-09 Thread Kaplan, Marc
This is definitely a kludgy way of doing it, but if I had that problem
and wanted to solve it quickly, I would put a file named THISISSERVER1
on \\server1\projects\. This way you can do an if exist
p:\THISISSERVER1 test. This is ugly, but it will work.

-Marc

 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:samba-
 [EMAIL PROTECTED] On Behalf Of
Alexander
 Lazarevich
 Sent: Wednesday, March 09, 2005 8:51 AM
 To: samba@lists.samba.org
 Subject: [Samba] windows /bat script question
 
 Subject isn't exactly samba, but samba people usually know a lot about
 windows bat scripting. Here's my problem:
 
 Currently our domain login script is doing this (among other things):
 
 ifmember.exe WINDOWS-DOMAIN\Projects
 if errorlevel 1 ( net use p: \\server1\projects )
 
 This works fine. The problem is I'm moving the projects storage to a
 different server called server 2 (which is linux running samba 3, so
it
 is samba related somewhat). The logic I need is:
 
 If p: is on server 1, remove the persistant share \\server1\projects,
then
 if p: does not exist, create a persistant share p: \\server2\projects.
 
 Sounds easy enough, but I have no idea how to test if a share is on a
 particular remote server. I'm trying if exist \\server1\projects,
but
 that doesn't work the way I want it as scripts seem to only understand
the
 local drive letter names, not the remote names. I could try to spit
out
 the contents of net use p: to a file, then parse out the remote name
 string, and compare that, but that seems like a hard way to accomplish
it
 and I don't want the script parsing out stuff during a login. There's
got
 to be an easier way.
 
 I could also just always remove the p:, then mount it from server2.
But
 that adds an extra /delete every single time someone logs on, I'd
prefer
 not to do that. I only want to /delete p: if p: is remote server1, not
if
 it's remote server 2.
 
 Anyone have an idea?
 
 Thanks in advance,
 
 Alex
 --
 To unsubscribe from this list go to the following URL and read the
 instructions:  https://lists.samba.org/mailman/listinfo/samba
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


RE: [Samba] windows /bat script question

2005-03-09 Thread Alexander Lazarevich
Thanks Marc and Nat,
I can't test for existence of anything on server1, since I'm actually 
moving the storage to server2, but I can do the following (in this case 
the testfile exists on some directory of server2):

if not exist p:\testfile (
   net use /delete p:
   ifmember.exe DOMAIN\Projects
   if errorlevel 1 net use p: \\server2\projects
)
I still want to run the net use /delete p: command even though 
server1\projects is offline, just because I want to remove any persistant 
connections to server1, so the clients will stop asking for 
server1\projects in the future.

The only downside here is if there is no connection to p: at all, the 
script still tries to remove p:, but that's no big deal since most 
profiles allready have p: persistantly mounted.

Thanks for the help!
Alex
On Wed, 9 Mar 2005, Kaplan, Marc wrote:
This is definitely a kludgy way of doing it, but if I had that problem
and wanted to solve it quickly, I would put a file named THISISSERVER1
on \\server1\projects\. This way you can do an if exist
p:\THISISSERVER1 test. This is ugly, but it will work.
-Marc
-Original Message-
From: [EMAIL PROTECTED]
[mailto:samba-
[EMAIL PROTECTED] On Behalf Of
Alexander
Lazarevich
Sent: Wednesday, March 09, 2005 8:51 AM
To: samba@lists.samba.org
Subject: [Samba] windows /bat script question
Subject isn't exactly samba, but samba people usually know a lot about
windows bat scripting. Here's my problem:
Currently our domain login script is doing this (among other things):
ifmember.exe WINDOWS-DOMAIN\Projects
if errorlevel 1 ( net use p: \\server1\projects )
This works fine. The problem is I'm moving the projects storage to a
different server called server 2 (which is linux running samba 3, so
it
is samba related somewhat). The logic I need is:
If p: is on server 1, remove the persistant share \\server1\projects,
then
if p: does not exist, create a persistant share p: \\server2\projects.
Sounds easy enough, but I have no idea how to test if a share is on a
particular remote server. I'm trying if exist \\server1\projects,
but
that doesn't work the way I want it as scripts seem to only understand
the
local drive letter names, not the remote names. I could try to spit
out
the contents of net use p: to a file, then parse out the remote name
string, and compare that, but that seems like a hard way to accomplish
it
and I don't want the script parsing out stuff during a login. There's
got
to be an easier way.
I could also just always remove the p:, then mount it from server2.
But
that adds an extra /delete every single time someone logs on, I'd
prefer
not to do that. I only want to /delete p: if p: is remote server1, not
if
it's remote server 2.
Anyone have an idea?
Thanks in advance,
Alex
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba