Network drives "Unavailable"

Paul Watson (101 posts)
June 8, 2016 02:49 PM
Accepted Answer

When the .bat script runs, NET USE reports that none of the mapped drive letters are available. Is there anything in adTempus that controls that? What might be wrong?

Status       Local     Remote                    Network

-------------------------------------------------------------------------------

Unavailable  L:        \\SWPDCENDWODB01\D$       Microsoft Windows Network

Unavailable  R:        \\SWPDCENDWODB01\D        Microsoft Windows Network

Unavailable  T:        \\SWPDCENDWODB02\D$\Install

                                                 Microsoft Windows Network

The command completed successfully.

Bill Staff (604 posts)
June 8, 2016 03:03 PM
Accepted Answer

This is a result of the way drive letter mappings are managed in Windows. See the Network Access for Jobs help topic for more information.

You should  use UNC paths rather than drive letters. If you don't want to hard-code paths in the batch file, use Job Variables/Environment Variables so you can define the path in adTempus and have the batch file use it.

If you must use a mapped drive letter the mapping has to be done on the Resources tab of the job. But note that this will fail if you try to use a drive letter that's already in use outside adTempus. For example you won't be able to create a mapping for L:. You would need to use a drive letter that's not already mapped.

Paul Watson (101 posts)
June 8, 2016 03:41 PM
Accepted Answer

So... Mapped drives which appear to a program run from the command prompt are invisible to a program run under adTempus. Is that right?

The following script shows several drives mapped when run from a cmd.exe shell. However, the driveMap.length is zero (0) when run under adTempus. Is that what I should expect to see?

===

set wshNetwork = WScript.CreateObject("WScript.Network")
set driveMap = wshNetwork.EnumNetworkDrives

wscript.echo driveMap.length

for i = 0 to (driveMap.length-2) step 2
    wscript.echo "drive letter " & i &" = " & driveMap.item(i+1)

    if (StrComp("\\" & hostname & "\" & sharename, driveMap.item(i+1), 1) = 0) then
        driveletter = driveMap.item(i)
    end if
next

Bill Staff (604 posts)
June 8, 2016 04:28 PM
Accepted Answer
The only drive mappings available to anything you run in adTempus are the mappings that you add on the Resources page of the job. Anything mapped outside of the job does not exist as far as your program is concerned.
Paul Watson (101 posts)
June 14, 2016 03:26 PM
Accepted Answer
Thank you for your help, Bill. I am a bit surprised that I have used adTempus this long and never come to know about this. It is working now.
Paul Watson (101 posts)
June 16, 2016 03:55 PM
Accepted Answer

Just an addendum. Using UNC paths can make many things work very smoothly. However, I find in scripting .bat scripts that keeping all directory names in UNC form can lead to problems if PUSHD is used frequently. And, this is not limited to a single script. It involves every script that is running concurrently on the system.

The problem comes when PUSHD on a UNC path will allocate another "drive letter" for itself. This works. However, DOS/Windows has a limited supply of additional "drive letters" that can be used. If the system is already using several, such as A: to D:, and 20 applications are run concurrently with each doing a single PUSHD on a UNC path, that is about the limit.

A good scheduler like adTempus will let you run many applications concurrently, but you have to watch out for depletion of global resources like "drive letters."

Replies are disabled for this topic.