endrec
asked on
How to create a .bat file that copies a file from one server to another under a particular user account?
Hello,
We have a need to copy a files from one location on a server to another location on a different server, however we need to impersonate or use the credentials of a particular service account. Is it possible to get a .bat file to copy a file using the credentials of a particular user, not neccessarily the user the executed the .bat file?
Example: We need File A to be copied from Server A Location A to Server B Location B. The .bat file is run by James, but the file copy needs to occur under Joe's account.
We have a need to copy a files from one location on a server to another location on a different server, however we need to impersonate or use the credentials of a particular service account. Is it possible to get a .bat file to copy a file using the credentials of a particular user, not neccessarily the user the executed the .bat file?
Example: We need File A to be copied from Server A Location A to Server B Location B. The .bat file is run by James, but the file copy needs to occur under Joe's account.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I believe inserting the password in plain text is permissible in this case.
alright...try this...Create a text file in the same folder where you batch file is and save as runa.vbs extension.
copy the code from above post and paste in that text file.save it.
Now run the vbs by double clicking on it or by running cscript filename.vbs
let us know if issues
copy the code from above post and paste in that text file.save it.
Now run the vbs by double clicking on it or by running cscript filename.vbs
let us know if issues
i wouldn't let the user's call batch files where the credentials of an account can be seen in plain text. even if you trust your users there can be malware which spies into those files.
i would let the user copy the file(s) to a share on the own computer (James). then at the destination account (Joe) there could be a local job in the task list (at) which periodically copies files from shares to that account.
Sara
i would let the user copy the file(s) to a share on the own computer (James). then at the destination account (Joe) there could be a local job in the task list (at) which periodically copies files from shares to that account.
Sara
These tasks will let you run a .bat file from a specific user at specific interval.
I would avoid putting this info in the .bat file because that compromises that user's password.