NAS cannot see mapped drive

b2amolb2amol Member Posts: 64
Hi,

I have a web application running from NAS. There is a file browse function on it, which does not work without supplying UNC path for a file to be uploaded.

Is there any way to store a mapping for a drive-letter within NAV and that can provide path to NAS?

Thanks,

Amol

Comments

  • garakgarak Member Posts: 3,263
    Your NAV (?) solution can't handle UNC :?: Does i understood this correct?
    U can only use mapped drives on your NAS service machine????
    I cant belive that, because i also use NAS and UNC!

    Maybe you have a security problem, that the windows user of the NAS serice doesn't have permissions to connect to this drive.
    So check the permissions.

    so, this could help also (as a little tip):

    viewtopic.php?f=5&t=22930
    Do you make it right, it works too!
  • rdebathrdebath Member Posts: 383
    I suspect the problem he's got is a windows user problem. Many users don't get the idea of UNC paths and if a user has to enter a path for the NAS this is a problem.

    Drive mappings are not shared between security areas, different users and different sessions have different sets of mapped drives. In general this means a NAS will only have the drives it maps for itself.

    This can be done two main ways ways ... firstly a command line. Get the NAS to run the command
    net use X: \\host\share
    
    Drive X: should then be available to the NAS.

    The second is to either run directly or translate into Navision COM manipulation this vbscript
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    Set AllDrives = WshNetwork.EnumNetworkDrives()
    Set FSO = CreateObject("Scripting.FileSystemObject")
    
    MapDrive "X:", "\\host\share"
    
    Function MapDrive(DriveLetter, DrivePath)
      Dim f
      Set f = FSO.GetFolder(DrivePath)
      If not f is Nothing then
    
        UnMapDrive(DriveLetter)
        Set AllDrives = nothing
    
        Set AllDrives = WshNetwork.EnumNetworkDrives()
    
        AlreadyConnected = False
      
        For i = 0 To AllDrives.Count - 1 Step 2
          If AllDrives.Item(i) = DriveLetter Then AlreadyConnected = True
        Next
    
        If AlreadyConnected = False then
          WShNetwork.MapNetworkDrive DriveLetter, DrivePath, False
        End if
      End if
    End Function
    
    Function UnMapDrive(DriveLetter)
      For i = 0 To AllDrives.Count - 1 Step 2
        If AllDrives.Item(i) = DriveLetter Then WShNetwork.RemoveNetworkDrive DriveLetter
      Next
    End Function
    
    I've been lucky, for me the users have been fine with 'use local drives only' or 'use UNC paths'.
  • b2amolb2amol Member Posts: 64
    Thank you Robert,

    I have some problem executing this

    I am trying out this:
    Using command:

    nassql.exe appservername=ServerName, nettype=tcp, servername=SeverName, database=dbName, company=CompanyName, startupparameter=Parameter1, startuppar
    ameter=Parameter2, objectcache=8000, net use X: \\host\share

    but i get error: Program Property 'net use X: \\host\share' is unknown. Could you please explain where to run net use?

    Thanks,

    Amol
  • rdebathrdebath Member Posts: 383
    Hmm, that's an interesting interpretation.

    Try the mapdrive function in this, put a call to it somewhere like CU1 trigger 99.
    OBJECT Report 60101 Map Drive
    {
      OBJECT-PROPERTIES
      {
        Date=12/04/10;
        Time=20:07:24;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        ProcessingOnly=Yes;
        OnPreReport=BEGIN
                      MapDrive('\\vmbackup\backup');
                    END;
    
      }
      DATAITEMS
      {
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
    
        PROCEDURE MapDrive@1000000000(UNC@1000000001 : Text[1024]);
        VAR
          WSH@1000000000 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:'Windows Script Host Object Model'.WshShell";
          WindowStyle@1000000002 : Integer;
          WaitOnRun@1000000003 : Integer;
          CmdString@1000000004 : Text[1024];
        BEGIN
          IF EXISTS('X:\NUL') THEN EXIT;
    
          CmdString := 'net use X: ' + UNC;
          CREATE(WSH);
          WindowStyle := 1; // 1 = Normal, 2 = Minimise, 3 = Maximise
          WaitOnRun := 1;
          WSH.Run(CmdString, WindowStyle, WaitOnRun);
          MESSAGE('Mapped');
        END;
    
        BEGIN
        END.
      }
    }
    
  • b2amolb2amol Member Posts: 64
    Hello Robert,

    That is Excellent! :thumbsup: That solved my problem, and I have a shared drive visible to NAS now.

    Thank you for your help!

    Amol
Sign In or Register to comment.