Logon script stops processing

G

Guest

This problem is appearing on Windows XP with SP2.
I am using the following statement in my logon script to map a drive if the
user has a particular system environment variable defined...

if %GreatPlainsUser% == 1 net use q:
\\servername\dynamics>>%SystemDrive%\logon.txt

If the user has the variable defined, everything runs fine. If the variable
is not defined, the logon script stops processing. I can run the exact same
command from a command prompt with no errors. Is there a way to ignore the
error so the logon script will continue?

To circumvent the problem, I have moved this line to the botton of the logon
script but would prefer to move it back where it was (in the middle of the
logon script).
 
P

Pegasus \(MVP\)

Shawn Anthony said:
This problem is appearing on Windows XP with SP2.
I am using the following statement in my logon script to map a drive if the
user has a particular system environment variable defined...

if %GreatPlainsUser% == 1 net use q:
\\servername\dynamics>>%SystemDrive%\logon.txt

If the user has the variable defined, everything runs fine. If the variable
is not defined, the logon script stops processing. I can run the exact same
command from a command prompt with no errors. Is there a way to ignore the
error so the logon script will continue?

To circumvent the problem, I have moved this line to the botton of the logon
script but would prefer to move it back where it was (in the middle of the
logon script).

Try this standard appoach instead:

if "%GreatPlainsUser%"=="1" net use q:
\\servername\dynamics>>%SystemDrive%\logon.txt
 
G

Guest

That does not work either. When I put the variables in quotes it does not map
the drive if the user does in fact have the variable defined.

I tried the following scenerios with no success...
if "%GreatPlainsUser%"=="1" net use q:
\\servername\dynamics>>%SystemDrive%\logon.txt

if (%GreatPlainsUser%)==(1) net use q:
\\servername\dynamics>>%SystemDrive%\logon.txt

Anymore suggestions?
 
G

Guest

I fixed it by using the following syntax.....
if %GreatPlainsUser%. == 1. net use q:
\\servername\dynamics>>%SystemDrive%\logon.txt

If the variable is not defined, the if statement fails. by appending a "."
to the variable it gives the if statement something to evaluate even if the
variable is not defined.

Thanks for your help!
 

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