Copy Files Form Remote

Hi, i would like to know how to create a powershell script that can copy files from remote PC to local pc. i got few things need to include into the script. Is there any script i can do

  1. Run admin credentials from non admin PC
  2. Copy 3 files from remote c C:\XX\XX to local pc
  3. detect username with $env:UserName, but don’t detect my admin account name when i run as my admin account
  4. Type in hostname and copy

LM,
Weclome to the forum. :wave:t4:

Your explanation is a bit vague and confusing at the same time.

1 Yes. You can run a script with elevated rights. The used account has to have access rights to the files / folders you want to reach on the remote computer.
2 The easiest way would be to use a UNC path like \\RemotePC\c$\xx\xx
3 I don’t know how that is related to the copy job
4 If I got it right you could use Read-Host to ask for user input.

Here are some basic help topics to get you started:

I’d recommend to read the help for the cmdlets completely including the examples to learn how to use them.