logon script failing to execute

M

MadDHatteR

My logon script does not run when an individual command at the end of the
script fails.

I have defined a domain-wide logon script that simply maps a few drives (in
the order shown):
net use m: \\server1\mshare
net use n: \\server1\nshare
net use u: \\server2\ushare

The entire script works great for users who have access to \\server2 -- all
3 drives map correctly. However; some of my users do not have access to
\\server2. I would expect these users to have m: and n: mapped with no u:
mapped, but that does not appear to be happening. It seems, if the last net
use command fails, the entire logon script does not run at all.

If the same logon script is run interactively, m: and n: map properly, and
then the script stops and asks for a password to map u: (since the supplied
credentials were invalid). This is fine, since I expect u: to fail for these
users. I'm baffled why m: and n: also fail. Anyone else run into this, or
have suggestions?

\\ MadDHatteR
 
J

Jerold Schulman

My logon script does not run when an individual command at the end of the
script fails.

I have defined a domain-wide logon script that simply maps a few drives (in
the order shown):
net use m: \\server1\mshare
net use n: \\server1\nshare
net use u: \\server2\ushare

The entire script works great for users who have access to \\server2 -- all
3 drives map correctly. However; some of my users do not have access to
\\server2. I would expect these users to have m: and n: mapped with no u:
mapped, but that does not appear to be happening. It seems, if the last net
use command fails, the entire logon script does not run at all.

If the same logon script is run interactively, m: and n: map properly, and
then the script stops and asks for a password to map u: (since the supplied
credentials were invalid). This is fine, since I expect u: to fail for these
users. I'm baffled why m: and n: also fail. Anyone else run into this, or
have suggestions?

\\ MadDHatteR
What is common among thesse users who don't have access to server2?
Are they in a specific group or OU or what?
Just test for the group or OU in the script and bypass the net use U: for
those users.



Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
M

MadDHatteR

Jerold Schulman said:
What is common among thesse users who don't have access to server2?

The users who don't have access to server2 live in ~10 separate OUs (about a
third of the departments don't have access). I could check for this, but
that's more logic and tests than I would like to put into a login script. We
are also trying to avoid separate login scripts for each OU. I'm aware there
are (cumbersome) ways to get around the problem, but I'm much more
interested in fixing the problem, or at least finding its cause.

\\ MadDHatteR
 
M

Marty List

MadDHatteR said:
The users who don't have access to server2 live in ~10 separate OUs (about a
third of the departments don't have access). I could check for this, but
that's more logic and tests than I would like to put into a login script. We
are also trying to avoid separate login scripts for each OU. I'm aware there
are (cumbersome) ways to get around the problem, but I'm much more
interested in fixing the problem, or at least finding its cause.

\\ MadDHatteR


Have you determined if the script is actually running? It doesn't make
sense that the other drives would not be mapped, it makes more sense the
script is not running at all. Make the first line of the script do
something you can track, like @Echo %DATE% %TIME%>> to a file.
 
G

Guest

Go to a PC that DOES NOT have access to \\server2
Open the command prompt (cmd.exe) and type
NET VIEW
and press [Enter] If you see \\server2 in the list,
even though you don't have "access" to it,
batch script #1 should solve your problem.
If \\server2 is not in the list, use batch script #2 or #3.


:::::::: START OF BATCH SCRIPT 1 ::::::::

net use m: \\server1\mshare
net use n: \\server1\nshare
net view \\server2 | find/i "There are no entries in the list"
if errorlevel 1 net use u: \\server2\ushare

::::::::: END OF BATCH SCRIPT 1 :::::::::


Scripts #1 and #2 work in all versions of Windows!


:::::::: START OF BATCH SCRIPT 2 ::::::::

net use m: \\server1\mshare
net use n: \\server1\nshare
net view | find/i "\\server2"
if errorlevel 1 goto end
net use u: \\server2\ushare
:end

::::::::: END OF BATCH SCRIPT 2 :::::::::


Batch script #3 is similar to #2
#3 is designed for Windows NT/2000/2003/XP only!


:::::::: START OF BATCH SCRIPT 3 ::::::::

net use m: \\server1\mshare
net use n: \\server1\nshare
net view | find/i "\\server2"
if %errorlevel% equ 0 net use u: \\server2\ushare

::::::::: END OF BATCH SCRIPT 3 :::::::::


*****************************************

I realize postings in this group are mostly DOS batch related,
but you can also use the Windows Scripting Host for logon scripts.

Copy the following script into any text editor (Notepad)
Save the file with a .vbs extension (i.e. LogonScript.vbs)
Use only if all your users have Windows 2000 or newer.


:::::::: START OF VISUAL BASIC SCRIPT ::::::::

On Error Resume Next
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "M:", "\\server1\mshare"
WshNetwork.MapNetworkDrive "N:", "\\server1\nshare"
WshNetwork.MapNetworkDrive "U:", "\\server2\ushare"

::::::::: END OF VISUAL BASIC SCRIPT :::::::::


This will only create the drive U share if access exists.

Austin M. Horst
 

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