Send a file to all network users automatically via WMIC command
I have a script with which I can scan the network for live ips and the
result is being sent to a file called "ip_list.txt". After that, I
would like to send a file "file.txt" on every ip address from the
ip_list.txt and put it on a specific folder to each user pc. (ex.
c:\temp)
You can use FOR /F to iterate through the values in the "ip_list.txt" file to then do an XCOPY to the hidden C$ share of all the PCs and then followed by the folder path where you want to copy that onto the "C" drive of each PC (i.e. C:\Temp
is equivelant to (\\<ip address>\C$\Temp
).
Give it a shot and see how it goes but I'd suggest testing this with just one or two IP addresses (once workgroup and one domain) inially in the "ip_list.txt" file and confirm that it works as expected.
The access on each PC would need to be enabled to complete this via the method below, your account it's run as would need to have access to the machines to do this (e.g. domain admin for domain PCs and local admin for the workgroup PCs perhaps).
You may have to embed credentials into the process for some of the IP addresses, but see how this goes and let me know. I'll update my answer with more detail if you have trouble, etc.
Example Command Prompt Run
(Note that the below example is a command prompt copy and paste type deal below and not a batch script, but I can change to run as a batch script if needed as well.)
FOR /F "TOKENS=*" %%A IN (c:\path\ip_list.txt) DO XCOPY /F /Y "C:\Path\file.txt" "\\%%~A\C$\Temp\"
Additional Resources