Discussion:
net use script issue with terminal server and DFS
(too old to reply)
Luca Grazioli
2008-12-09 13:22:18 UTC
Permalink
Hi guys,

i've 2 win 2003 terminal server (1 r2 ent version and 1 std version). Only
with the standard version there's a problem with the logon script. The script
starts but the desktop become blue and only a command window (nothing inside)
appears, the title is "usrlogon.cmd". If i close this windows the desktop
appears correctly but the net use mapping doesn't run. With the other ts
server there is no problem.

the problem is started when i've activeted the DFS on another win 2003 ent
rs server.

Any idea?

Tnx
Vera Noest [MVP]
2008-12-09 20:12:51 UTC
Permalink
It seems that the server is hanging on a command in usrlogon.cmd.
Open the file in notepad and check for any paths that are
incorrect.
If there's an "echo off" command at the top of the file, you can
temporarily comment that out, which will enable you to see any
error messages that are produced.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___

=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi guys,
i've 2 win 2003 terminal server (1 r2 ent version and 1 std
version). Only with the standard version there's a problem with
the logon script. The script starts but the desktop become blue
and only a command window (nothing inside) appears, the title is
"usrlogon.cmd". If i close this windows the desktop appears
correctly but the net use mapping doesn't run. With the other ts
server there is no problem.
the problem is started when i've activeted the DFS on another
win 2003 ent rs server.
Any idea?
Tnx
Luca Grazioli
2008-12-10 09:05:00 UTC
Permalink
Hi Vera and tnx for your reply :-)

So...i've done other tests and the problem seems to be in the path of the
unit mapped like home directory (in the terminal server profile). So: the
script, with DFS path, runs; the profile, with DFS path, is ok; the unit
(Z:), mapped like home directory, doesn't work only if i use the dfs path (in
this case i have blue screen and usrlogon.cmd window). If i change it with a
direct path there is no problem. Ah! the issue is only with a ts server the
other works fine.

thank u!

Luca
Post by Vera Noest [MVP]
It seems that the server is hanging on a command in usrlogon.cmd.
Open the file in notepad and check for any paths that are
incorrect.
If there's an "echo off" command at the top of the file, you can
temporarily comment that out, which will enable you to see any
error messages that are produced.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi guys,
i've 2 win 2003 terminal server (1 r2 ent version and 1 std
version). Only with the standard version there's a problem with
the logon script. The script starts but the desktop become blue
and only a command window (nothing inside) appears, the title is
"usrlogon.cmd". If i close this windows the desktop appears
correctly but the net use mapping doesn't run. With the other ts
server there is no problem.
the problem is started when i've activeted the DFS on another
win 2003 ent rs server.
Any idea?
Tnx
Vera Noest [MVP]
2008-12-10 09:55:57 UTC
Permalink
When it doesn't work, what is the error message?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___

=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi Vera and tnx for your reply :-)
So...i've done other tests and the problem seems to be in the
path of the unit mapped like home directory (in the terminal
server profile). So: the script, with DFS path, runs; the
profile, with DFS path, is ok; the unit (Z:), mapped like home
directory, doesn't work only if i use the dfs path (in this case
i have blue screen and usrlogon.cmd window). If i change it with
a direct path there is no problem. Ah! the issue is only with a
ts server the other works fine.
thank u!
Luca
Post by Vera Noest [MVP]
It seems that the server is hanging on a command in
usrlogon.cmd. Open the file in notepad and check for any paths
that are incorrect.
If there's an "echo off" command at the top of the file, you
can temporarily comment that out, which will enable you to see
any error messages that are produced.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi guys,
i've 2 win 2003 terminal server (1 r2 ent version and 1 std
version). Only with the standard version there's a problem
with the logon script. The script starts but the desktop
become blue and only a command window (nothing inside)
appears, the title is "usrlogon.cmd". If i close this windows
the desktop appears correctly but the net use mapping doesn't
run. With the other ts server there is no problem.
the problem is started when i've activeted the DFS on another
win 2003 ent rs server.
Any idea?
Tnx
Luca Grazioli
2008-12-10 10:24:07 UTC
Permalink
there is no error message, nothing in the ts's ev, nothing in the dc's ev.
Simply a usrlogon.cmd black window that, if the user doesnt close it, the
desktop doesnt appear...
Post by Vera Noest [MVP]
When it doesn't work, what is the error message?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi Vera and tnx for your reply :-)
So...i've done other tests and the problem seems to be in the
path of the unit mapped like home directory (in the terminal
server profile). So: the script, with DFS path, runs; the
profile, with DFS path, is ok; the unit (Z:), mapped like home
directory, doesn't work only if i use the dfs path (in this case
i have blue screen and usrlogon.cmd window). If i change it with
a direct path there is no problem. Ah! the issue is only with a
ts server the other works fine.
thank u!
Luca
Post by Vera Noest [MVP]
It seems that the server is hanging on a command in
usrlogon.cmd. Open the file in notepad and check for any paths
that are incorrect.
If there's an "echo off" command at the top of the file, you
can temporarily comment that out, which will enable you to see
any error messages that are produced.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi guys,
i've 2 win 2003 terminal server (1 r2 ent version and 1 std
version). Only with the standard version there's a problem
with the logon script. The script starts but the desktop
become blue and only a command window (nothing inside)
appears, the title is "usrlogon.cmd". If i close this windows
the desktop appears correctly but the net use mapping doesn't
run. With the other ts server there is no problem.
the problem is started when i've activeted the DFS on another
win 2003 ent rs server.
Any idea?
Tnx
Vera Noest [MVP]
2008-12-10 13:10:43 UTC
Permalink
No, a failed net use command won't generate an event in the
EventLog.
But it should give you an error message when you execute the same
command interactively. Temporarily disable usrlogon.cmd (you can
put an "exit" command on the first line to do so), logon as a
normal user and execute the failing command from a command prompt.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___

=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
there is no error message, nothing in the ts's ev, nothing in
the dc's ev. Simply a usrlogon.cmd black window that, if the
user doesnt close it, the desktop doesnt appear...
Post by Vera Noest [MVP]
When it doesn't work, what is the error message?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi Vera and tnx for your reply :-)
So...i've done other tests and the problem seems to be in the
path of the unit mapped like home directory (in the terminal
server profile). So: the script, with DFS path, runs; the
profile, with DFS path, is ok; the unit (Z:), mapped like
home directory, doesn't work only if i use the dfs path (in
this case i have blue screen and usrlogon.cmd window). If i
change it with a direct path there is no problem. Ah! the
issue is only with a ts server the other works fine.
thank u!
Luca
Post by Vera Noest [MVP]
It seems that the server is hanging on a command in
usrlogon.cmd. Open the file in notepad and check for any
paths that are incorrect.
If there's an "echo off" command at the top of the file, you
can temporarily comment that out, which will enable you to
see any error messages that are produced.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi guys,
i've 2 win 2003 terminal server (1 r2 ent version and 1
std version). Only with the standard version there's a
problem with the logon script. The script starts but the
desktop become blue and only a command window (nothing
inside) appears, the title is "usrlogon.cmd". If i close
this windows the desktop appears correctly but the net use
mapping doesn't run. With the other ts server there is no
problem.
the problem is started when i've activeted the DFS on
another win 2003 ent rs server.
Any idea?
Tnx
Luca Grazioli
2008-12-11 17:32:01 UTC
Permalink
Hi Vera,

ok i've done that u have suggested. I've disabled usrlogon.cmd and the user
is logged correctly. So i've tried to run usrlogon.cmd (rem @echo off) with
the terminal server user. this is the copy of the command:

C:\WINDOWS\Application Compatibility Scripts>Set RootDrive=Z:
C:\WINDOWS\Application Compatibility Scripts>If "AZ:A" == "AA" End.Cmd
C:\WINDOWS\Application Compatibility Scripts>Rem
C:\WINDOWS\Application Compatibility Scripts>Rem Map the User's Home
Directory to a Drive Letter
C:\WINDOWS\Application Compatibility Scripts>Rem
C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D 1>NUL: 2>&1

it stops here!
----------------------------------------------------------------------------------------


Tnx!
Post by Vera Noest [MVP]
No, a failed net use command won't generate an event in the
EventLog.
But it should give you an error message when you execute the same
command interactively. Temporarily disable usrlogon.cmd (you can
put an "exit" command on the first line to do so), logon as a
normal user and execute the failing command from a command prompt.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
there is no error message, nothing in the ts's ev, nothing in
the dc's ev. Simply a usrlogon.cmd black window that, if the
user doesnt close it, the desktop doesnt appear...
Post by Vera Noest [MVP]
When it doesn't work, what is the error message?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi Vera and tnx for your reply :-)
So...i've done other tests and the problem seems to be in the
path of the unit mapped like home directory (in the terminal
server profile). So: the script, with DFS path, runs; the
profile, with DFS path, is ok; the unit (Z:), mapped like
home directory, doesn't work only if i use the dfs path (in
this case i have blue screen and usrlogon.cmd window). If i
change it with a direct path there is no problem. Ah! the
issue is only with a ts server the other works fine.
thank u!
Luca
Post by Vera Noest [MVP]
It seems that the server is hanging on a command in
usrlogon.cmd. Open the file in notepad and check for any
paths that are incorrect.
If there's an "echo off" command at the top of the file, you
can temporarily comment that out, which will enable you to
see any error messages that are produced.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi guys,
i've 2 win 2003 terminal server (1 r2 ent version and 1
std version). Only with the standard version there's a
problem with the logon script. The script starts but the
desktop become blue and only a command window (nothing
inside) appears, the title is "usrlogon.cmd". If i close
this windows the desktop appears correctly but the net use
mapping doesn't run. With the other ts server there is no
problem.
the problem is started when i've activeted the DFS on
another win 2003 ent rs server.
Any idea?
Tnx
jolteroli
2008-12-11 18:40:31 UTC
Permalink
the "net use z: /D" removes the mapping of drive z:. the following "1>nul"
and "2>&1" is IO redirection. the redirections have to be read from
right2left:

1.) redirect stderr (2) into stdout (1)
2.) redirect stdout (1) into NUL

in fact, the whole output stdout/stderr of the "net use ..." command will be
redirected to NUL, the byte eater. this is a common method to supress
warning and errors.

what seems odd to me, is the colon right after NUL, anyone an idea?

i would suggest, you remove the "1>NUL: 2>&1" and run the script again.
you'll see the error message of "net use ..." if the command doesn't block.
finally you can try to delete the just the colon.

if it still blocks, then try to manually remove the Z: mapping via explore
and logoff the user. may be there is a problem in the unmapping process.

-jolt
Post by Luca Grazioli
Hi Vera,
ok i've done that u have suggested. I've disabled usrlogon.cmd and the user
C:\WINDOWS\Application Compatibility Scripts>If "AZ:A" == "AA" End.Cmd
C:\WINDOWS\Application Compatibility Scripts>Rem
C:\WINDOWS\Application Compatibility Scripts>Rem Map the User's Home
Directory to a Drive Letter
C:\WINDOWS\Application Compatibility Scripts>Rem
C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D 1>NUL: 2>&1
it stops here!
----------------------------------------------------------------------------------------
Tnx!
Post by Vera Noest [MVP]
No, a failed net use command won't generate an event in the
EventLog.
But it should give you an error message when you execute the same
command interactively. Temporarily disable usrlogon.cmd (you can
put an "exit" command on the first line to do so), logon as a
normal user and execute the failing command from a command prompt.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
there is no error message, nothing in the ts's ev, nothing in
the dc's ev. Simply a usrlogon.cmd black window that, if the
user doesnt close it, the desktop doesnt appear...
Post by Vera Noest [MVP]
When it doesn't work, what is the error message?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi Vera and tnx for your reply :-)
So...i've done other tests and the problem seems to be in the
path of the unit mapped like home directory (in the terminal
server profile). So: the script, with DFS path, runs; the
profile, with DFS path, is ok; the unit (Z:), mapped like
home directory, doesn't work only if i use the dfs path (in
this case i have blue screen and usrlogon.cmd window). If i
change it with a direct path there is no problem. Ah! the
issue is only with a ts server the other works fine.
thank u!
Luca
Post by Vera Noest [MVP]
It seems that the server is hanging on a command in
usrlogon.cmd. Open the file in notepad and check for any
paths that are incorrect.
If there's an "echo off" command at the top of the file, you
can temporarily comment that out, which will enable you to
see any error messages that are produced.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi guys,
i've 2 win 2003 terminal server (1 r2 ent version and 1
std version). Only with the standard version there's a
problem with the logon script. The script starts but the
desktop become blue and only a command window (nothing
inside) appears, the title is "usrlogon.cmd". If i close
this windows the desktop appears correctly but the net use
mapping doesn't run. With the other ts server there is no
problem.
the problem is started when i've activeted the DFS on
another win 2003 ent rs server.
Any idea?
Tnx
Vera Noest [MVP]
2008-12-11 21:35:48 UTC
Permalink
I couldn't have answered any better, jolteroli :-)
No, I've no idea either how or why that colon appears after NUL,
but I've done a quick test, and it doesn't seem to be a problem.
Net Use Z: /D 1>NUL: 2>&1 does remove the drive mapping, and it
does redirect all output to the NUL device.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
Post by jolteroli
the "net use z: /D" removes the mapping of drive z:. the
following "1>nul" and "2>&1" is IO redirection. the redirections
1.) redirect stderr (2) into stdout (1)
2.) redirect stdout (1) into NUL
in fact, the whole output stdout/stderr of the "net use ..."
command will be redirected to NUL, the byte eater. this is a
common method to supress warning and errors.
what seems odd to me, is the colon right after NUL, anyone an
idea?
i would suggest, you remove the "1>NUL: 2>&1" and run the script
again. you'll see the error message of "net use ..." if the
command doesn't block. finally you can try to delete the just
the colon.
if it still blocks, then try to manually remove the Z: mapping
via explore and logoff the user. may be there is a problem in
the unmapping process.
-jolt
Post by Luca Grazioli
Hi Vera,
ok i've done that u have suggested. I've disabled usrlogon.cmd and the user
is logged correctly. So i've tried to run usrlogon.cmd (rem
@echo off) with
C:\WINDOWS\Application Compatibility Scripts>If "AZ:A" == "AA"
End.Cmd C:\WINDOWS\Application Compatibility Scripts>Rem
C:\WINDOWS\Application Compatibility Scripts>Rem Map the User's
Home Directory to a Drive Letter
C:\WINDOWS\Application Compatibility Scripts>Rem
C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D
1>NUL: 2>&1
it stops here!
----------------------------------------------------------------
------------------------
Tnx!
Post by Vera Noest [MVP]
No, a failed net use command won't generate an event in the
EventLog.
But it should give you an error message when you execute the
same command interactively. Temporarily disable usrlogon.cmd
(you can put an "exit" command on the first line to do so),
logon as a normal user and execute the failing command from a
command prompt.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
there is no error message, nothing in the ts's ev, nothing
in the dc's ev. Simply a usrlogon.cmd black window that, if
the user doesnt close it, the desktop doesnt appear...
Post by Vera Noest [MVP]
When it doesn't work, what is the error message?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi Vera and tnx for your reply :-)
So...i've done other tests and the problem seems to be in
the path of the unit mapped like home directory (in the
terminal server profile). So: the script, with DFS path,
runs; the profile, with DFS path, is ok; the unit (Z:),
mapped like home directory, doesn't work only if i use
the dfs path (in this case i have blue screen and
usrlogon.cmd window). If i change it with a direct path
there is no problem. Ah! the issue is only with a ts
server the other works fine.
thank u!
Luca
Post by Vera Noest [MVP]
It seems that the server is hanging on a command in
usrlogon.cmd. Open the file in notepad and check for any
paths that are incorrect.
If there's an "echo off" command at the top of the file,
you can temporarily comment that out, which will enable
you to see any error messages that are produced.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email
___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Hi guys,
i've 2 win 2003 terminal server (1 r2 ent version and
1 std version). Only with the standard version there's
a problem with the logon script. The script starts but
the desktop become blue and only a command window
(nothing inside) appears, the title is "usrlogon.cmd".
If i close this windows the desktop appears correctly
but the net use mapping doesn't run. With the other ts
server there is no problem.
the problem is started when i've activeted the DFS on
another win 2003 ent rs server.
Any idea?
Tnx
Luca Grazioli
2008-12-12 10:44:14 UTC
Permalink
Great Guys!

So i've removed "1>NUL: 2>&1" and this is the error message:
--------
C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D
There are open files and/or incomplete directory searches pending on the
connection to Z:.

do you want to continue the disconnection and abnormal termination ? (Y/N)
[N]:
(this is an italian S.O., so i translate the message)
------------
if i reply Y or N the window close and the user can work...but which is the
file open?!?

this is the complete script running text:
--------------------------
Z:\>rem @Echo Off

Z:\>Call "C:\WINDOWS\Application Compatibility Scripts\SetPaths.Cmd"

Z:\>REM ###############################################################

Z:\>REM # #

Z:\>REM # SetPaths #

Z:\>REM # #

Z:\>REM # Extracts the following paths into environment variables, #

Z:\>REM # allowing the scripts to run without hardcoded system path #

Z:\>REM # strings. This allows the scripts to run independently of #

Z:\>REM # system language. #

Z:\>REM # #

Z:\>REM # All Users:Startup COMMON_STARTUP #

Z:\>REM # All Users:Start Menu COMMON_START_MENU #

Z:\>REM # All Users:Start Menu\Programs COMMON_PROGRAMS #

Z:\>REM # Current User:Start Menu USER_START_MENU #

Z:\>REM # Current User:Startup USER_STARTUP #

Z:\>REM # Current User:Start Menu\Programs USER_PROGRAMS #

Z:\>REM # Current User:My Documents MY_DOCUMENTS #

Z:\>REM # Current User:Templates TEMPLATES #

Z:\>REM # Current User:Application Data APP_DATA

Z:\>REM # #

Z:\>REM ###############################################################

Z:\>REM ###############################################################

Z:\>REM # Use the GETPATHS option to set all of the environment variables

Z:\>REM ###############################################################

Z:\>"C:\WINDOWS\Application Compatibility Scripts\ACRegL.exe"
"E:\DOCUME~1\GRAZI
O~1\IMPOST~1\Temp\3\getpaths.cmd" COMMON_PATHS "HKLM\Software" "" GETPATHS

Z:\>If Not ErrorLevel 1 Goto Cont1

Z:\>Call "E:\DOCUME~1\GRAZIO~1\IMPOST~1\Temp\3\getpaths.cmd"

Z:\>SET COMMON_START_MENU=E:\Documents and Settings\All Users\Menu Avvio

Z:\>SET COMMON_STARTUP=E:\Documents and Settings\All Users\Menu
Avvio\Programmi\
Esecuzione automatica

Z:\>SET COMMON_PROGRAMS=E:\Documents and Settings\All Users\Menu
Avvio\Programmi


Z:\>SET USER_START_MENU=E:\Documents and Settings\graziolil\Menu Avvio

Z:\>SET USER_STARTUP=E:\Documents and Settings\graziolil\Menu
Avvio\Programmi\Es
ecuzione automatica

Z:\>SET USER_PROGRAMS=E:\Documents and Settings\graziolil\Menu Avvio\Programmi

Z:\>SET MY_DOCUMENTS=Documenti

Z:\>SET TEMPLATES=Modelli

Z:\>SET APP_DATA=Dati applicazioni

Z:\>Del "E:\DOCUME~1\GRAZIO~1\IMPOST~1\Temp\3\getpaths.cmd" 1>Nul: 2>&1

Z:\>REM If the values below are correct, execution has succeeded

Z:\>REM COMMON_START_MENU = E:\Documents and Settings\All Users\Menu
Avv
io

Z:\>REM COMMON_STARTUP = E:\Documents and Settings\All Users\Menu
Avvio\
Programmi\Esecuzione automatica

Z:\>REM COMMON_PROGRAMS = E:\Documents and Settings\All Users\Menu
Avvio
\Programmi

Z:\>REM USER_START_MENU = E:\Documents and Settings\graziolil\Menu
Avvio


Z:\>REM USER_STARTUP = E:\Documents and Settings\graziolil\Menu
Avvio\Pr
ogrammi\Esecuzione automatica

Z:\>REM USER_PROGRAMS = E:\Documents and Settings\graziolil\Menu
Avvio\P
rogrammi

Z:\>REM MY_DOCUMENTS = Documenti

Z:\>REM TEMPLATES = Modelli

Z:\>REM APP_DATA= Dati applicazioni

Z:\>Set _SetPaths=SUCCEED

Z:\>Goto Done

Z:\>If "SUCCEED" == "FAIL" Goto Done

Z:\>Rem

Z:\>Rem This is for those scripts that don't need the RootDrive.

Z:\>Rem

Z:\>If Not Exist "C:\WINDOWS\System32\Usrlogn1.cmd" Goto cont0

Z:\>Rem

Z:\>Rem Determine the user's home directory drive letter. If this isn't

Z:\>Rem set, exit.

Z:\>Rem

Z:\>Cd /d C:\WINDOWS\"Application Compatibility Scripts"

C:\WINDOWS\Application Compatibility Scripts>Call RootDrv.Cmd

C:\WINDOWS\Application Compatibility Scripts>If Exist
"C:\WINDOWS\Application Co
mpatibility Scripts\RootDrv2.Cmd" Call "C:\WINDOWS\Application Compatibility
Scr
ipts\RootDrv2.Cmd"


C:\WINDOWS\Application Compatibility Scripts>REM

C:\WINDOWS\Application Compatibility Scripts>Set RootDrive=Z:

C:\WINDOWS\Application Compatibility Scripts>If "AZ:A" == "AA" End.Cmd

C:\WINDOWS\Application Compatibility Scripts>Rem

C:\WINDOWS\Application Compatibility Scripts>Rem Map the User's Home
Directory t
o a Drive Letter

C:\WINDOWS\Application Compatibility Scripts>Rem

C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D
There are open files and/or incomplete directory searches pending on the
connection to Z:.

do you want to continue the disconnection and abnormal termination ? (Y/N)
[N]:

-------------------------
Vera Noest [MVP]
2008-12-12 13:31:57 UTC
Permalink
OK, we're getting closer :-)
The script you posted is the standard usrlogon.cmd script, nothing
strange or wrong there.
By the way, I've used this script for years, never noticed the
funny colon in "1>NUL: 2>&1", but it's there!

Maybe it's a timing problem? What if you logon, answer No to the
question on disconnection, proceed with the logon until you get to
the desktop. Then open explorer, do you have a drive Z: then, or
not? Assuming that you have, can you then manually remove the
connection? Either in explorer, or in a command window (better,
because you can easier copy error messages). Can you repeatedly map
and unmap Z:?

_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___

=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Great Guys!
--------
C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D
There are open files and/or incomplete directory searches
pending on the connection to Z:.
do you want to continue the disconnection and abnormal
(this is an italian S.O., so i translate the message)
------------
if i reply Y or N the window close and the user can work...but
which is the file open?!?
Luca Grazioli
2008-12-12 14:48:19 UTC
Permalink
i've used a script to delete the unit Z: but with the same error. If i select
N, the unit isnt unmap; if i select Y the unit is unmap and remap correctly.
If i remap the unit and try to run again my script, the unit z is unmapped!!!

So, the problem is only for the first time...Naturally i have the error only
with DFS path, if i use direct path "\\server\shared" all run correctly
Post by Vera Noest [MVP]
OK, we're getting closer :-)
The script you posted is the standard usrlogon.cmd script, nothing
strange or wrong there.
By the way, I've used this script for years, never noticed the
funny colon in "1>NUL: 2>&1", but it's there!
Maybe it's a timing problem? What if you logon, answer No to the
question on disconnection, proceed with the logon until you get to
the desktop. Then open explorer, do you have a drive Z: then, or
not? Assuming that you have, can you then manually remove the
connection? Either in explorer, or in a command window (better,
because you can easier copy error messages). Can you repeatedly map
and unmap Z:?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Great Guys!
--------
C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D
There are open files and/or incomplete directory searches
pending on the connection to Z:.
do you want to continue the disconnection and abnormal
(this is an italian S.O., so i translate the message)
------------
if i reply Y or N the window close and the user can work...but
which is the file open?!?
jolteroli
2008-12-12 18:56:51 UTC
Permalink
huh, how does come N: and Y: into the game now? just for clarification:

(o) in a logon script, you map the share \\someserver\someshare to the drive
letter Z:, where the share is a distributed file system.

(o) then users will work with files from Z:, like they do with files from
any
other share.

(o) if the user logs off, the logoff script hangs while removing the map of
Z:,
ok.

-----------

from my understanding, a process (still alive while running the logoff.cmd)
must have a whatsoever-handle open to a directory/file/... on Z:

this "forgotten/heldopen-handle" prevents "net use Z: /D" from doing its
work cleanly and so it asks for what to do now.

well, we have two choices:

1.) wild guess, but i bet it works: echo "Y" into the net use command. this
were the same as when the
user would see this message and answer by [Y].

echo Y | net use Z: /d 1>NUL 2>&1

but that's quick'n'dirty...

2.) find the process, still having a file/directory/... open somewhere
in the dfs share aka Z:.

to figure this out, i would look on the file server for opened file, but
since it is a distributed share, i'm not sure on which "server" to look for
this information? never worked with dfs...

however, the "process explorer" can show to what objects a process is
holding
handles to.

http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

so, drop the exe to c:\windows on your terminal server

login as a user experiencing the unmap-problem, logoff and let the
logoff script stuck where it comes to remove the Z: mapping.

then login as admin, start the process explorer, check view>lower pane
view>handles and add the column username. now check every process
belonging to the user. in the lower pane you can see all the handles of the
process. look for a handle type of "file" and the path beginning by "\Dfs"

long post, but quickly done ;)

-jolt

PS: Tack, but I really doubt on that Vera... :)
Post by Luca Grazioli
i've used a script to delete the unit Z: but with the same error. If i select
N, the unit isnt unmap; if i select Y the unit is unmap and remap correctly.
If i remap the unit and try to run again my script, the unit z is unmapped!!!
So, the problem is only for the first time...Naturally i have the error only
with DFS path, if i use direct path "\\server\shared" all run correctly
Post by Vera Noest [MVP]
OK, we're getting closer :-)
The script you posted is the standard usrlogon.cmd script, nothing
strange or wrong there.
By the way, I've used this script for years, never noticed the
funny colon in "1>NUL: 2>&1", but it's there!
Maybe it's a timing problem? What if you logon, answer No to the
question on disconnection, proceed with the logon until you get to
the desktop. Then open explorer, do you have a drive Z: then, or
not? Assuming that you have, can you then manually remove the
connection? Either in explorer, or in a command window (better,
because you can easier copy error messages). Can you repeatedly map
and unmap Z:?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Great Guys!
--------
C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D
There are open files and/or incomplete directory searches
pending on the connection to Z:.
do you want to continue the disconnection and abnormal
(this is an italian S.O., so i translate the message)
------------
if i reply Y or N the window close and the user can work...but
which is the file open?!?
Luca Grazioli
2008-12-12 23:19:01 UTC
Permalink
eheheh maybe i need to sum the trouble

-there are 2 terminal server (one, 2003 R2 Ent and one 2003 std, all sp2)
-each user can access with a Load balancer gateway
-when user logon, starts a script (usrlogon.cmd) that map the home unit (z)
-the home unit has a dfs path (\\domainname\root\homedirectory)
-when the user logon, only in the terminal server standard edition, the
usrlogon.cmd script hangs, and the problem is the unmap of Z (thanks guys! :-)
-in the terminal server enterprise edition, with same users, there is no
problem
-if i use a direct path (no dfs, but \\server\shared) to the same directory
(for the home directory there isn't replica service), there is no problem

So, if i understand, i can:
-modify the usrlogon.cmd only in the standar version to force the unmapping
command
-change the dfs path to direct path (only for terminal server user)
-pray ;-)
Post by jolteroli
(o) in a logon script, you map the share \\someserver\someshare to the drive
letter Z:, where the share is a distributed file system.
(o) then users will work with files from Z:, like they do with files from
any
other share.
(o) if the user logs off, the logoff script hangs while removing the map of
Z:,
ok.
-----------
from my understanding, a process (still alive while running the logoff.cmd)
this "forgotten/heldopen-handle" prevents "net use Z: /D" from doing its
work cleanly and so it asks for what to do now.
1.) wild guess, but i bet it works: echo "Y" into the net use command. this
were the same as when the
user would see this message and answer by [Y].
echo Y | net use Z: /d 1>NUL 2>&1
but that's quick'n'dirty...
2.) find the process, still having a file/directory/... open somewhere
in the dfs share aka Z:.
to figure this out, i would look on the file server for opened file, but
since it is a distributed share, i'm not sure on which "server" to look for
this information? never worked with dfs...
however, the "process explorer" can show to what objects a process is
holding
handles to.
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
so, drop the exe to c:\windows on your terminal server
login as a user experiencing the unmap-problem, logoff and let the
logoff script stuck where it comes to remove the Z: mapping.
then login as admin, start the process explorer, check view>lower pane
view>handles and add the column username. now check every process
belonging to the user. in the lower pane you can see all the handles of the
process. look for a handle type of "file" and the path beginning by "\Dfs"
long post, but quickly done ;)
-jolt
PS: Tack, but I really doubt on that Vera... :)
Post by Luca Grazioli
i've used a script to delete the unit Z: but with the same error. If i select
N, the unit isnt unmap; if i select Y the unit is unmap and remap correctly.
If i remap the unit and try to run again my script, the unit z is unmapped!!!
So, the problem is only for the first time...Naturally i have the error only
with DFS path, if i use direct path "\\server\shared" all run correctly
Post by Vera Noest [MVP]
OK, we're getting closer :-)
The script you posted is the standard usrlogon.cmd script, nothing
strange or wrong there.
By the way, I've used this script for years, never noticed the
funny colon in "1>NUL: 2>&1", but it's there!
Maybe it's a timing problem? What if you logon, answer No to the
question on disconnection, proceed with the logon until you get to
the desktop. Then open explorer, do you have a drive Z: then, or
not? Assuming that you have, can you then manually remove the
connection? Either in explorer, or in a command window (better,
because you can easier copy error messages). Can you repeatedly map
and unmap Z:?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?THVjYSBHcmF6aW9saQ==?=
Post by Luca Grazioli
Great Guys!
--------
C:\WINDOWS\Application Compatibility Scripts>Net Use Z: /D
There are open files and/or incomplete directory searches
pending on the connection to Z:.
do you want to continue the disconnection and abnormal
(this is an italian S.O., so i translate the message)
------------
if i reply Y or N the window close and the user can work...but
which is the file open?!?
TP
2008-12-13 01:13:57 UTC
Permalink
Hi Luca,

Your Terminal Server's root drive is set to the same drive
letter as what you are using for the user's home drive. This
conflicts and needs to be changed.

Do you need to have a root drive *and* a home drive? If
yes, then I think the easiest thing to do is change the root
drive letter on your TS, for example, change it to W:

You can do this by logging on to your TS as an admin,
delete RootDrv2.Cmd and chkroot.key files, and then run
chkroot.cmd. Enter W: in the correct place and then save
and exit notepad (make sure there are no spaces after the
drive letter and colon).

After you have completed the changes restore your
usrlogon.cmd file to what it was before your began
troubleshooting.

Thanks.

-TP
Post by Luca Grazioli
eheheh maybe i need to sum the trouble
-there are 2 terminal server (one, 2003 R2 Ent and one 2003 std, all sp2)
-each user can access with a Load balancer gateway
-when user logon, starts a script (usrlogon.cmd) that map the home unit (z)
-the home unit has a dfs path (\\domainname\root\homedirectory)
-when the user logon, only in the terminal server standard edition,
the usrlogon.cmd script hangs, and the problem is the unmap of Z
(thanks guys! :-) -in the terminal server enterprise edition, with
same users, there is no problem
-if i use a direct path (no dfs, but \\server\shared) to the same
directory (for the home directory there isn't replica service), there
is no problem
-modify the usrlogon.cmd only in the standar version to force the
unmapping command
-change the dfs path to direct path (only for terminal server user)
-pray ;-)
Vera Noest [MVP]
2008-12-13 21:48:14 UTC
Permalink
Post by jolteroli
huh, how does come N: and Y: into the game now?
That confused me as well at first. But N and Y are not drive letters,
but Y(es) and N(o) answers to the prompt "do you want to continue
disconnecting the drive?".

_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
jolteroli
2008-12-14 11:01:37 UTC
Permalink
*red face*

How are the elks doing? ...

-jolt ;)
Post by Vera Noest [MVP]
Post by jolteroli
huh, how does come N: and Y: into the game now?
That confused me as well at first. But N and Y are not drive letters,
but Y(es) and N(o) answers to the prompt "do you want to continue
disconnecting the drive?".
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
Luca Grazioli
2008-12-16 17:11:01 UTC
Permalink
Hi guys,

i dunno where is the real problem, so i'll try editing the script like
jolteroi has suggested me:

"echo Y | Net Use %RootDrive% /D >NUL: 2>&1"

thanks for all!

if i find something else, i'll post it

Cya!

Continue reading on narkive:
Loading...