Map network drive in background

G

Guest

Hi,

I need to map a network drive without a user logging on. For example, when
you start a server and are prompted at the Ctrl-Alt-Del logon box, I want a
mapped network drive avliable in the background.

I have tried to run a script on startup and this falis as it seems to wonly
work when a user is logged in ?

Any ideas would be helpful.

ThanksS
 
P

Pegasus \(MVP\)

S said:
Hi,

I need to map a network drive without a user logging on. For example, when
you start a server and are prompted at the Ctrl-Alt-Del logon box, I want a
mapped network drive avliable in the background.

I have tried to run a script on startup and this falis as it seems to wonly
work when a user is logged in ?

Any ideas would be helpful.

ThanksS

Mapping a drive in the background is not an option, because
its access rights will be valid within the context of the account
used for the background job. If the drive was visible in the
foreground then you would have a security violation - hence
drives mapped in the background remain invisible to foreground
sessions.

Why do you actually want the drive to be mapped before
the user logs in?
 
G

Guest

I'm trying to get an application to see a share such as \\server1\share as a
drive letter g:\. I'm not an application devloper, I'm from a server support
background.

Is there anyway around this taking the responsibility myself for any advice
given ?
 
P

Pegasus \(MVP\)

You did not say in your reply why you wanted the drive
to be mapped ***before*** the user logs on. I suggest
you map the drive ***while*** the user logs on, by
placing an appropriate batch file into his startup folder.
 
G

Guest

Hi,

I wanted to map the network drive so the application can see it without a
user loggining on.
 
P

Pegasus \(MVP\)

You have two choices:
- Use UNC coding, or
- Map the drive with the same process that launches the application.
 
G

Guest

first choice has already been implemeted and doesn't work too well that's why
i;m trying to map a network drive

how would i acheive second choice ? If application is running in background
when server has started will network drive be mapped with that process ?
 
P

Pegasus \(MVP\)

Applications don't just "run" in the background - something's got
to launch them. What's launching yours?
 
G

Guest

The application is running as a service, so when the server starts the
service is automatically started, just as a normal service under windows. So
the application is running before the user logs in.
 
P

Pegasus \(MVP\)

This is really something that the supplier of the application
should address. If he does not then perhaps you're trying
to run the application in a manner that it is not designed for.

If you still wish to run it in this manner then you can roll
your own service call. To do so, you need to do a few things:

1. Memorise the command line for your service. You an find
it with regedit.exe under the ImagePath value for your service in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\

2. Create a batch file c:\tools\YourService.bat

3. Place the following lines into this batch file:
line1 @echo off
line2 c:\winnt\system32\net.exe use q: \\YourServer\YourShare
/user:YourServer\SomeAccount SomePassword
line3 xxxx

where SomeAccount/SomePassword is an account with sufficient
access rights to \\YourServer\YourShare, and xxx is the command
line you memorised in Step 1. Don't abbreviate anything in the
beginning of line2 - it will cause the command to fail.

4. Replace the ImagePath command line with c:\tools\YourService.bat.

5. Run gpedit.msc and use it to stop your service, then to restart it to see
how things work.
 
G

Guest

The problem I have now is that when the service starts, it seems to have
mapped the network drive but it's in a disconnected stated with a red cross
and when I double click on it, it's not avliable. I use net view and it's
not showing up. Howevr when I run the service manually it says logon
failure: unknown username or bad password, but I know the command works fine
as I have tested it from the command prompt.
 
P

Pegasus \(MVP\)

Because the drive was mapped in the background, under an
account other than your own, it will be visible to that same
background session only but not to your foreground session.

As I mentioned before, this is really something that the
supplier of your program should address.
 

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