Jump to content

RunAs to copy files to network location


Recommended Posts

Hi all,

I've been trying to find a way to be able to copy files to a network location where only the domain admin account has access. I was checking a bunch of RunAs posts but cannot seem to find a solution to my problem.

Here's one way I've tried to do this but you all are welcome to propose another way:

RunAs($adminuser, $admindomain, $adminpass, 2, 'cmd copy /Y c:\Temp\userinfo.log \\backup\user\userinfo.log', @SystemDir)

Ideally I would like to copy an entire folder but in this example it is just one file. The thing is that this is ran as a domain user and the network location is only accessible with the domain admin account.

Any ideas are very much appreciated.

Link to comment
Share on other sites

Hi all,

I've been trying to find a way to be able to copy files to a network location where only the domain admin account has access. I was checking a bunch of RunAs posts but cannot seem to find a solution to my problem.

Here's one way I've tried to do this but you all are welcome to propose another way:

RunAs($adminuser, $admindomain, $adminpass, 2, 'cmd copy /Y c:\Temp\userinfo.log \\backup\user\userinfo.log', @SystemDir)

Ideally I would like to copy an entire folder but in this example it is just one file. The thing is that this is ran as a domain user and the network location is only accessible with the domain admin account.

Any ideas are very much appreciated.

You didn't say what was wrong with what you already have...

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

If it works I would just go with it. Furthermore, if you need to copy all the files in that folder I am pretty sure all you need to do is go from this:

RunAs($adminuser, $admindomain, $adminpass, 2, 'cmd copy /Y c:\Temp\userinfo.log \\backup\user\userinfo.log', @SystemDir)

To this:

RunAs($adminuser, $admindomain, $adminpass, 2, 'cmd copy /Y c:\Temp\userinfo.log \\backup\user\*', @SystemDir)

[font="Times New Roman"]Ocho.[/font]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...