Jump to content
Sign in to follow this  
kuldeep

Copy File from remote machine with User credential

Recommended Posts

kuldeep

Hi,

I am new to autoit and programming also. I am developing an application using autoit in which user will click a button and file will get copied from remote machine to his machine. I can copy a file locally using FileCopy but i don't know how to copy a file from remote machine. I tried to copy file by providing path of remote machine FileCopy(\\10.70.160.85\C$\temp.txt, "C:\dir\") but it is not working.

So can anyone help me how can i copy file from remote machine and how can i provide user credential who has rights to access that path.

Share this post


Link to post
Share on other sites
Juvigy

Does it work when you manually do it ? (open 10.70.160.85C$ and copy/paste) ?

Share this post


Link to post
Share on other sites
Tjalve

I think this is a windows security issue.

If you want to use the c$ share on a machine, you need admin priviliges unless you have manually added the user in question.

My suggestion would be to share a specific folder (Like C:Myshare) and give the users the access they need to that folder. And then use:

filecopy("10..70.160.85Mysharetemp.txt","C:dir")

Share this post


Link to post
Share on other sites
kuldeep

Hi,

Thanks for help...

I have got the solution. I have used Runas command as below

RunAsWait("userid","domain","Password", 0, @ComSpec & ' /c ' & 'copy "\\10.70.160.85\C$\temp.txt, "C:\dir\"', "", @SW_HIDE)

It is working fine

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×