Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while copying file from one remote server to other remote server #350

Open
mmanjunatha opened this issue Jun 3, 2022 · 0 comments

Comments

@mmanjunatha
Copy link

mmanjunatha commented Jun 3, 2022

Hi,

I have requirement to copy file from one remote server to other remote server(let's say server A and B), so I am using pywinrm to connect to remote server(Server A) from my local then running command to copy file from server A to Server B. I am getting access denied for this operation. have configured winrm in both the server with same user and able to perform other activity individually and only for copy I am facing issue.

My python code:


import winrm
cmd = "copy-item -Path D:\\\\test.txt -Destination \\\\<Server B>\\D$\\"
url = "https://<Server A>:5986/wsman"
remote = winrm.Session(url , auth=("<username>", "<Password>"),transport='ntlm', server_cert_validation='ignore')
run_ps = remote.run_ps(cmd)

print run_ps.std_err
print run_ps.std_out

Getting below error
`copy-item : Access is denied
At line:1 char:1

  • copy-item D:\test.txt \xxx.xx.xx.xx\D$\
  •   + CategoryInfo          : NotSpecified: (:) [Copy-Item], UnauthorizedAccessException
      + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.CopyItemCommand
    

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant