Sign in to follow this  
Followers 0
Brobbl

Copying a file with other user rights

6 posts in this topic

Hey there,

first of all, I habe googled this problem but i didnt find a good solution to what i need to do... so please, hepl me :-)

Problem: While setting up computers over pxe, I run a script that reads a XML-file and checks for given parameters like reg-keys, files, services, etc. and writes the results of all checks right back into the file. This script runs with system rights, which wont let me copy the file onto a network share...

What I want: I need to copy a file to a network share, but the user running the script doesnt have the necessary rights to write into that share. Is there any solution to this?

Share this post


Link to post
Share on other sites



You can create  a network account to be used for this purpose, and use RunAs to perform the actions as that network account. Then just give that account the required access to the share.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Thank you, JLogan3o13, yes, I have access to a Functional User that is basically a domain admin and has rights to write into the share.

But I wanted to avoid Runas since I have to call an external script (Batch is easiest for this purpose i think).

I already thought about creating a "copy.bat", calling it with Runas, and deleting it afterwards, but i thought there could be... well, a smarter way of solving this.

Share this post


Link to post
Share on other sites

RunAs is the safest way, but you can also use DriveMapAdd. attention:

this temporarily gives the admin rights to the running user; so you must disconnect (DriveMapDel) as soon as possible. you must also make sure the connection is not cached.

Share this post


Link to post
Share on other sites

Thank you, JLogan3o13, yes, I have access to a Functional User that is basically a domain admin and has rights to write into the share.

But I wanted to avoid Runas since I have to call an external script (Batch is easiest for this purpose i think).

I already thought about creating a "copy.bat", calling it with Runas, and deleting it afterwards, but i thought there could be... well, a smarter way of solving this.

 

Depends on your definition of "smarter". I would simply write the script that does the job you want it to do, use FileInstall to drop it somewhere, use RunAs to run it, delete it. In, out, and done.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Okay, so thank you all for the input, im going to look into the fileinstall() topic asap.

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  
Followers 0