Forum Discussion

anitha_lakshmi1's avatar
anitha_lakshmi1
Contributor
12 years ago

Copy file from LAN

Hi,

       I need to copy a file from one computer to other within  LAN, but while copying it will ask for credentials, So how can I pass credentials using VB script in test complete.



I used builtin.copy it works fine wiothout credentials. But I need a way on how to do this with credentials...



Please do the needful

5 Replies

  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    Or just connect to the remote resource manually before. Run "net use \\SomeRemotePath thisismypassword /user:mydomain\myusername" before doing your copy to ensure the credentials are cached every time.
  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 2 rankChampion Level 2
    Hi,



    Just curious: why do you need to use credentials if BuiltIn.CopyFile works? What is the goal - to check that the credentials window is shown or to copy the file and proceed with the test?
  • Hi,



        Builtin.copy works fine if the copy operation does not asks for credentials. But in my case while accessing some systems then it pops up a window asking for credentials(like usename and password) then Builtin.copy does not work fine.  So I need away to copy file from the PC within LAN by passing its credentials
  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 2 rankChampion Level 2
    Hi,



    Hm-m-m...

    Does the BuiltIn.CopyFile() works if you manually provide network credentials in the shown window (i.e. the code runs the .CopyFile() line; the window is shown; you manually provide credentials; .CopyFile() completes successfully) ?

    If the above works, then you may consider to execute .CopyFile using the Runner.CallObjectMethodAsync() method, wait for the credentials window for some reasonable time (e.g. for 5 seconds) and then wait in a loop until the file is copied to the destination.
  • Hi,



       If I provide credentials  prior to execution then it will work fine. Is there any way to provide credentiaol in script itself so that it will work even thou if I wont set credentials prior to execution.