TLDR: I need to move a large file from a server to the desktop of multiple SELECT machines connected to it.
Network topography:
- 1 Server
- 5 - 20 Connected PCs
This topography is pretty standard across all remote networks that I work on. On some occasions, I have to put files on each machine on a network; sometimes only on a few individual machines that site admins utilize.
I keep a 'master copy' of the file on the server at all times, and currently RDPing into each machine i need it on (once I resolve the IP to make sure they aren't printers/tablets/phones/etc...) and copy over the file where I need it from the server to the connected machine (the directory is standard). After researching, I think a PS script would probably work for what I need but I only know enough to be dangerous.
I use the following to resolve IPs to host names so I can determine which machines I need to put it on:
@echo off setlocal EnableDelayedExpansion set "xNext=" set "xComputer=" for /f %%A in ('net view /all') do ( set "xComputer=%%~A" if "!xComputer:~0,2!"=="\\" for /f "tokens=2,* delims=. " %%X in ('nslookup %%A') do ( if "!xNext!"=="1" ( echo.!xComputer! = %%X.%%Y set "xNext=0" ) if "!xComputer:~2!"=="%%~X" set "xNext=1" ) ) endlocal pause
I want the ability to use the output of this code to build a list of IPs, then FTP the file to the IPs to a common directory C:/Folder
. I could build a ComputerList.txt
with the IPs and use it but I'm not quite sure how to integrate it.