# UNC mapped drive without user sessions

There's a similar question, but it was about whether it is possible or not. I want to put it in a different way:

How do I create a UNC mapped drive which will be mounted at startup without anybody logging in?

As an aside
I need this for a sharepoint application. I cannot just use UNC access because the web site uses impersonation and I would need delegation set up to allow for UNC access. Enabling delegation is risky and needs domain-wide configuration changes. A network mapped drive helps to avoid delegation in this scenario.

-

The PSTOOL suite can also be helpful in this situation.

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

-
Hmm, just skimmed through the list and I can't see any tool solving or helping to solve this problem in a direct way –  axk May 22 '09 at 18:57

I ran into this situation on a project I was working for. Basically what I did was to make a special service that gets activated at startup.

Here is my solution for a Windows Server 2003 R2 x64 system: NOTE: HKEY-LOCAL-MACHINE really uses underlines however it kept getting reformatted here. NOTE: I applogize in advance for any typos.

1. Install Windows 2003 Server Resource Kit. For reference e:\windows resource kits\tools

2. c:

3. cd \

4. In a CMD window execute the following commands

regsvr32 /s %systemroot%\system32\vbscript.dll

copy e:\"windows resource kits"\tools\srvany.exe c:\

e:\"windows resource kits"\tools\instsrv aaaaxx c:\srvany.exe

5. Using regedit

Select HKEY-LOCAL-MACHINE->SYSTEM->CurrentControlSet->Services->aaaaxx

While pointing on aaaaxx (Right Click)->New->Key and enter Parameters

Select Parameters

  (Right Click)->New->String Value->Application


Select Application

  (Right Click)->Modify and enter c:\aaaaxx.bat

6. In the CMD window enter notepad c:\aaaaxx.bat. Remember to save the file.

Enter something similar to the following:

rem
rem This is a batch file
rem
C:\windows\system32\net.exe use w: \\server\mountpoint PASSWORD /user:domain\user /persistent:yes >c:\xxx.out
rem
rem This is the end of the batch file
rem

7. To test use: net start aaaaxx. If there is a failure some information might be in c:\xxx.out

8. Check for the mount in the CMD window using:

w:

dir

NOTE: Its interesting the disk mounted in this way DO NOT appear in net use but are really mounted there.

-

You should be able to do so by using autoexnt from the Windows Server 2003 Resource Kit. It allows you to run a batch file without logging in. There are articles on the Internet about how to do this.

-
Although it looks like the simplier solution, I recall that this did not work properly. –  mdpc May 16 '09 at 23:26
I know it has for us. We have an app that has to write its report files before providing them for view. Load balanced web servers. So we used this tool to provide the drive mapping for each web server. –  K. Brian Kelley May 17 '09 at 1:23
Is your situation 32-bit or a 64-bit? –  mdpc May 18 '09 at 4:04
AutoExNT will not work on 64bit systems. –  Sergio Jun 19 '09 at 6:04

Maybe you can open the share to the computer account (machinename\$) and then the system can access network ressources?

-

Another option may be to create a null session share, instructions are available from http://support.microsoft.com/default.aspx?scid=kb;en-us;q289655

Of course, as microsoft so succintly put it "If you configure a shared resource in this manner, the resource is not secure. Microsoft does not recommend that you use this configuration if you are considering null session security"

-
This doesn't seem to be what I'm looking for. In my case the service is running under a domain account, the problem is that it also uses impersonation which makes it's network identity into "anonymous user". –  axk May 22 '09 at 18:50
Thought it might work, my understanding is that it stops asking for authentication. We've used it before so that computers can use thier system account to pick install files up. –  Tubs May 26 '09 at 10:12