On Mar 25, 2013, at 7:13 PM, Harris, Jeffrey E. wrote:



-----Original Message-----
From: Patrick Flaherty [mailto:pflah...@rampageinc.com]
Sent: Monday, March 25, 2013 6:58 PM
To: Tomcat Users List
Subject: Re: runtime.exec "cmd.exe /C net use"


On Mar 25, 2013, at 1:15 PM, Howard W. Smith, Jr. wrote:

On Mon, Mar 25, 2013 at 11:14 AM, Patrick Flaherty
<pflah...@rampageinc.com>wrote:

Update: If I'm login interactively (meaning machine boots and I
login
and get my desktop) and that interactive account matches the service login account then "net use" from within the service does return all
mapped drives.


I expected as much. It seems as though you cannot get away from the
requirement of having to login 'first'...to get everything working as
designed/expected in your app.

Excuse me, if I missed the business requirement specification
(earlier
in this conversation), but is the requirement only to get a list of
mapped drives for 'your' user login or any enduser that logs into the
production server/client/PC/machine?

can you add the list of network drives to a database table, and
maintain the database table and retrieve the list from that database
table via the tomcat-app-running-as-service?

if you only need a list of mapped network drives for your user login,
can you just maintain a 'file' that has this list on the
target/production server, and whenever it changes, can you update the
file, and make the topcat-app-running-as-service to always read the
file instead of having to call 'net use'?

IMHO and FWIW, i would never go with the approach of relying on a
windows 'command line' to do this/that for me. yes, in my app, i
allow
endusers to update files/documents, and the app saves the
files/documents to a certain folder on the server, and my app will
list those files on a web page, and they can view/download those
files
from/via the web app... all that is done via java instead of doing a
'cmd.exe dir'. i'm new to java, always wanted to be java developer,
and loving what i can do with java. i'm almost getting to the point,
where my days of a 'windows user' are done...
one
day, i hope to migrate to linux for target server instead of windows
server. :)

This is what I see. If my service logs in as "service-user" and I login
normally to my desktop as "dt-user".
I call "net use" from my service and get an empty list. Now I logout as
"dt-user"and login as "service-user" and I mapped
4 drives and only 2 of the drives are mapped persisted (i.e. reconnect
at logon). I logout as "service-user" and now I have my app call "net
use" programatically and it returns the 2 drives that were mapped with
persistence.
Conclusion: Whatever drives are mapped persisted when logged in as the
user the service logs in as, then your app can call "net use" and get
those drives returned from "net use"
even if your logged in as "dt-user" OR nobody is logged in at all !!!!

Maybe someone can confirm my finding, but this is what I see.

Thanks again
Pat


You are on a Windows 7 system, which supports one user logged in at a time. I would be interested in seeing how this behaves on a Windows Server 2008 R2 system, configured for multiple users to be logged on at the same time (the default for remote administration mode is one user at a time). I do believe this is an artifact of the Windows 7 architecture (one user at a time) because Windows Server 2008 R2 has different "security zones" (rings) in its kernel implementation for access by different components (services, drivers, and users) which affect the presentation to the user.

Also, persistent mappings are user specific. So if usera has two persistent drive mappings and userb has three different persistent mappings, usera will see his two when he is logged on and userb will see his three when he is logged on. Do you have the same persistent mappings for dt-user and service-user? You have also stated that you see no mapped drives when you run the service, so it seems as though starting the service first (and never having anyone logged in or dt-user) is an exception. Therefore, by extension of what you said above, you only receive the mapped drives if 1) the service starts first and then the service account logs in interactively, or 2) the service starts after logging in with the service account. Did you try both of these? But once the service "sees" the mappings, it retains it until: the service restarts? Does it matter whether the service restarts with someone logged on (i.e., the service account) or no one
logged in?

I do not think that you have explored all of the conditions required for the service to maintain its mappings, and that may be fine for your application, but then again, it may not be. That is
for you to decide.

Jeffrey Harris

After the the drives are mapped persisted by the "service-user", I reboot the computer and have nobody login interactively and my app sees all drives that were mapped persistently using "net use". That is my app running as a service can programatically see the drives via "net use". It is able to derive the drives that were mapped *persisted* somehow someway. I have no idea if it's by design or whether or not I can hang my hat on it, but it is what I have observed.

I did not know you could have multiple logins in Windows 2008 R2. You don't mean interactive login do you?

I hope this is clear and thanks for keeping me honest.
-Pat


This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to