Smart Login Script

G

Guest

We are replicating our file server to a second machine. This is working very
good for us as part of our backup strategy.

However, our current login script maps drivers to server1, or primary
server, only. We have struggled in writing a smart login script that will
map drives according to the following logic:

if (server1 is on-line) {
map drive \\server1\share E:
}
else if (server2 is on-line) {
{
map drive \\server2\share E:
}
else
{
Report Error
}

Ultimately we'd like this script to map printers in the same way if possible.

Any help is appreciated.
 
D

David H. Lipman

I suggest Kixtart Login Script Interpreter, http://kixtart.org Kixtart is CareWare.

I have used it for *all* my login scripts and for installing software, patches, fixes, anti
virus updates and service packs.

--
Dave




| We are replicating our file server to a second machine. This is working very
| good for us as part of our backup strategy.
|
| However, our current login script maps drivers to server1, or primary
| server, only. We have struggled in writing a smart login script that will
| map drives according to the following logic:
|
| if (server1 is on-line) {
| map drive \\server1\share E:
| }
| else if (server2 is on-line) {
| {
| map drive \\server2\share E:
| }
| else
| {
| Report Error
| }
|
| Ultimately we'd like this script to map printers in the same way if possible.
|
| Any help is appreciated.
 
J

Jerold Schulman

We are replicating our file server to a second machine. This is working very
good for us as part of our backup strategy.

However, our current login script maps drivers to server1, or primary
server, only. We have struggled in writing a smart login script that will
map drives according to the following logic:

if (server1 is on-line) {
map drive \\server1\share E:
}
else if (server2 is on-line) {
{
map drive \\server2\share E:
}
else
{
Report Error
}

Ultimately we'd like this script to map printers in the same way if possible.

Any help is appreciated.

if exist \\server1\share goto s1
if exist \\server2\share goto s2
@echo both servers are down
endlocal
goto :EOF
:s1
net use E: \\server1\share
goto finish
:s2
net use E: \\server2\share
:finish
....
....
endlocal



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 
G

Guest

David,

Thanks for your quick response.

I'm not familiar with kixtart, but have heard of it. I'm concerned that
kixtart will need to be installed on all my clients in order to use it.

In an interest to keeping things as managable as possible, I'd prefer not to
have to do this.

If kixtart can work by being installed only on our domain controller, or
file server, then I'd be very interested to learn more about how you
accomplished what you have with it.
 
J

Jeff Whitehead

Darn... beat me to it ;-)

Have just a slight tweak I was already working on, so you don't have to type
them in twice for two different servers.
Also, I think (hope?) this will bail out as soon as the first live server is
found, rather than trying each one in turn...
All you need to change is the server name in the 'if exist' lines and of
course add your mappings lower down, referencing the %svr% variable.

if exist \\server1\share (
set svr=server1
) else if exist \\server2\share (
set svr=server2
) else goto error

REM Add your mappings here
net use E: \\%svr%\share
goto end

:error
@echo both servers are down
goto end

:end

 
D

David H. Lipman

Kixtart can be executed from the Server. It only consists of one EXE and three DLL files.
However it can just as easily be pushed to the workstations by a LOGIN.BAT batch file.

The way I did it is that I looked to see if KIX32.EXE is in the %windir% directory. If it
was there run the Kix Login Script. If it wasn't there copy KIX32.EXE to %windir% and the
DLL files to %windir%\system then run the Kix Login Script.

Kixtart gives you both manageability and flexibility. It can read and write to the
Registry, has a BASIC like syntax and has a very powerful command set and it fully supports
Win2003 Server.

--
Dave




|
| David,
|
| Thanks for your quick response.
|
| I'm not familiar with kixtart, but have heard of it. I'm concerned that
| kixtart will need to be installed on all my clients in order to use it.
|
| In an interest to keeping things as managable as possible, I'd prefer not to
| have to do this.
|
| If kixtart can work by being installed only on our domain controller, or
| file server, then I'd be very interested to learn more about how you
| accomplished what you have with it.
| "David H. Lipman" wrote:
|
| > I suggest Kixtart Login Script Interpreter, http://kixtart.org Kixtart is CareWare.
| >
| > I have used it for *all* my login scripts and for installing software, patches, fixes,
anti
| > virus updates and service packs.
| >
| > --
| > Dave
| >
| >
| >
| >
| > | > | We are replicating our file server to a second machine. This is working very
| > | good for us as part of our backup strategy.
| > |
| > | However, our current login script maps drivers to server1, or primary
| > | server, only. We have struggled in writing a smart login script that will
| > | map drives according to the following logic:
| > |
| > | if (server1 is on-line) {
| > | map drive \\server1\share E:
| > | }
| > | else if (server2 is on-line) {
| > | {
| > | map drive \\server2\share E:
| > | }
| > | else
| > | {
| > | Report Error
| > | }
| > |
| > | Ultimately we'd like this script to map printers in the same way if possible.
| > |
| > | Any help is appreciated.
| >
| >
| >
 
D

David H. Lipman

I forgot to add, the command - AddPrinterConnection( )
will help solve your printer mapping as well.

--
Dave




|
| David,
|
| Thanks for your quick response.
|
| I'm not familiar with kixtart, but have heard of it. I'm concerned that
| kixtart will need to be installed on all my clients in order to use it.
|
| In an interest to keeping things as managable as possible, I'd prefer not to
| have to do this.
|
| If kixtart can work by being installed only on our domain controller, or
| file server, then I'd be very interested to learn more about how you
| accomplished what you have with it.
|
 
G

Guest

Thanks everyone. This has gotten me on the right track. If I have any more
questions after consuming this, I know who to come to.


Jeff Whitehead said:
Darn... beat me to it ;-)

Have just a slight tweak I was already working on, so you don't have to type
them in twice for two different servers.
Also, I think (hope?) this will bail out as soon as the first live server is
found, rather than trying each one in turn...
All you need to change is the server name in the 'if exist' lines and of
course add your mappings lower down, referencing the %svr% variable.

if exist \\server1\share (
set svr=server1
) else if exist \\server2\share (
set svr=server2
) else goto error

REM Add your mappings here
net use E: \\%svr%\share
goto end

:error
@echo both servers are down
goto end

:end
 
D

David H. Lipman

Actually the following is a BETTER News Group to go to ...

microsoft.public.windows.server.scripting

--
Dave




| Thanks everyone. This has gotten me on the right track. If I have any more
| questions after consuming this, I know who to come to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top