0

I am working from Windows Server 2012 R2 from that server I am connected to a internal network, to which there are numerous computers that I have access to. What I want to do is based on a specific users IP address in that network I want to pull 3 specific files out of that computer and make a copy to a specified location on my server. The files are always located in the same file path location for each individual computer and have the same file name.

From what I understand is that I should be able to write a script to perform this.

Copy-Item -ComputerName -Path filepath -Destination filepath destination

I don't want to use the computer name as it is more convoluted to find, it would be nice to enter in the IP of the address I am pulling the 3 files from.

Or if there is an easier-quicker way to copy the files from the PowerShell environment that would also be very helpful.

1 Answer 1

1

If you want to copy files from a remove machine to e.g. your own, you could run

Copy-Item -Path '\\<ip>\<file>' -Destination <local path> 

E.g. I tried running

Copy-Item -Path '\\10.0.0.10\C$\winbox.exe' -Destination c:\tmp 

between two domain joined computers, to which my user account has access to, works fine. 10.0.0.10 is the remote machine.

Sign up to request clarification or add additional context in comments.

1 Comment

That worked. If I want to pull 3 files from the same location is there a way to speed that up? Example: Copy-Item -Path '\\10.0.0.10\C$\filea.exe' -Destination c:\tmp Copy-Item -Path '\\10.0.0.10\C$\fileb.exe' -Destination c:\tmp Copy-Item -Path '\\10.0.0.10\C$\filec.exe' -Destination c:\tmp Or - if possible can I make a script and set a variable for the IP address. Then set the variable then run the script? The file names are the same on every destination computer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.