Windows – Problem using Windows runas to copy a windows network folder

copyrunaswindows

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?

Best Answer

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.