Copy files across domains

Hi

I need to copy a single file from domain A to domain B. I have different usernames on each domain and I know I have enoungh privileges on each one.

I cann’t be able to make the copy. Im trying with robocopy and with Copy-Item :frowning:

I’m doing it manually, from de domain A, I make a “network map” with the “use different user” option to map the domain B location. And then use the windows explorer to do the copy. I want to make the copy by script to schedule the task.

Please help…!

thanks in advance

Eusebio M

 

Hi Eusebio,

Create a PSDrive that points to the destination location to do the copy.

[pre]
New-PSDrive -Name Dest -PSProvider FileSystem -Root \destdomain\share -Credential <credential>

Copy-Item -Path localPath -Destination Dest:\ -Recurse
[/pre]

pwshliquori

hi

Thanks , it works…!