robocopy from a shared folder using winrm

0

My goal is to use winrm to connect to a remote machine and then run a robocopy command on this remote machine that results into copying files from a remote shared drive on the network into this machine but the problem is that robocopy reports "Access Denied" to the remote share folder.

My suspicion is that winrm is running as network services and shared folder reject access to it. BTW, the shared folder access is eveyone but I think network services still can not access the shared folder. My assumption is that winrm run script things under network services. Is that correct?

I tried changing the winrm service to run under admin account but I can not restart the winrm service as I gives the following error

Windows could not start the Windows Windows Remote Management (WS-Management)
on local computer.
Error 1079: The account specified for this service is different from the
from the account specified for other services running in the same process.

How can I solve this?

NOTE: I have to use winrm because I am using opscode knife tool for remote connectivity and they only support winrm.

Is it possible to impersonate robocopy right on command line passed to winrm?

iCode

Posted 2012-12-20T11:31:03.030

Reputation: 131

When you authenticate, is the user you log in as marked as an admin on that machine? – horatio – 2012-12-20T18:14:55.890

yes, it is the admin account on that machine – iCode – 2012-12-20T21:16:47.510

Answers

0

Try PSExec; along with a command to execute, you can specify the credentials with which to log on, so you can run your robocopy command as whatever user you need to.

Aaron Miller

Posted 2012-12-20T11:31:03.030

Reputation: 8 849

please see my note – iCode – 2012-12-20T21:21:54.643