Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need users to be able to copy a folder on a network share to another folder on the same share. They need to copy security too. They cannot use their normal logged in account as it doesn't have enough permissions (the folder is a "template" folder and is locked down with restrictive NTFS security).

So I created a proxy account with full permissions and a batch file that calls runas like

runas /noprofile /env /user:proxyaccount@mydomain.com z:\copy_folder.cmd

copy_folder.cmd just contains a robocopy command to copy the folder.

The runas fails with "cannot find file copy_folder.cmd". Z: is mapped correctly and I have tried runas without the /noprofile and /env switches but I get the same error.

What syntax should I be using for runas to find copy_folder.cmd?

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

Network shares are not brought over as part of runas even with the /env switch. I would use the UNC path to the Z: drive mapping.

share|improve this answer
    
I second that. Always use a UNC path if possible. Drive mappings are a bit 20th century. –  Tim Long Aug 5 '09 at 2:42
    
Yes the UNC path worked. Thanks for your help. –  martinr Aug 6 '09 at 7:33
add comment

may be you need to map the Z: for proxyaccount beforehand

share|improve this answer
add comment

As I know runas supports specifying UNC path as a program argument. robocopy I guess will handle it too. So you can just use UNC path as Zypher suggested.

But how do you provide a password into that runas call? What triggers that routine? If you used /savecred to store the password then it stored within user's setting and you need to save it for each user. Even worse that the user can get this password in a plain text if he want to.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.