Share via


copy file to remote computer from local with credentials using powershell

Question

Tuesday, November 22, 2011 3:21 PM

Hi,

I'm trying to copy files from my local machine to remote machine.

I tried giving credentials to copy-item but it's not supported.

Please help me how to achieve this.

Srikanth Peddy. MCTS-BizTalk Server Please mark as answered .

All replies (4)

Tuesday, November 22, 2011 3:46 PM âś…Answered

First remove all connetions(net use * /delete) to this server or using ip address instead of name.

F$ - local disk F on the remote computer.

PS >  net use Z: \\Win\F$\destfldr /user:Alexander MYPAsss
The command completed successfully.

PS >  dir Z:\
PS >  copy C:\Windows\win.ini Z:\
PS >  dir Z:\


    Directory: Z:\


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        13.07.2011     13:50        219 win.ini


PS >  net use
New connections will be remembered.


Status       Local     Remote                    Network

-------------------------------------------------------------------------------
OK           Z:        \\Win\F$\destfldr         Microsoft Windows Network
The command completed successfully.

PS >  net use * /delete
You have these remote connections:

    Z:              \\Win\F$\destfldr
Continuing will cancel the connections.

Do you want to continue this operation? (Y/N) [N]: y
The command completed successfully.

Tuesday, November 22, 2011 3:27 PM

net use Z \\server\C$\CopyFolder /user:UserName Password
copy file Z:\
net use * /delete

Tuesday, November 22, 2011 3:35 PM

Kazun,

Can u plz xplain in detail.

$sourcePath="\SourceSystem\tempfldr"

$destPath="D:\destfldr"

i want to copy sourcepath folders to dest path.

I tried using

net use but raising "multiple connections to server or shared resource by the same user ,using more than one user name ,are not allowed" error.

Srikanth Peddy. MCTS-BizTalk Server Please mark as answered .


Wednesday, November 23, 2011 10:46 AM

Thanks Kazun.

 

Srikanth Peddy. MCTS-BizTalk Server Please mark as answered .