Jump to content

Copying a file with other user rights


Go to solution Solved by JLogan3o13,

Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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.

Link to comment
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.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

  • Moderators
  • Solution

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...