Hi All, First of all thank you for reading my post. Recently Razor2.3 really helped me in creating batch file to disable windows service it was very helpful and I am back with another request to make my daily job more automated.
Query:
0. Every run should display date time and append log...
1. Ping 500 remote computers listed under computerlist.txt and
2. Use VBScript to search for file under C:\temp\abc.txt on remote pc if it's online
3. If file doesn't exist then have output in logfile to notify us (most important)We can also have some advanced option of using xcopy to copy 15MB file on remote pc but I wasn't sure about result if remote pc shutdown in between copy or can we use something like bits admin?
If using xcopy is too much then can always start manual copying of file over network.
I have got below code which only works with single pc and does echo if file exist:
( Ref: http://blogs.technet.com/b/heyscrip...
ther-a-file-exists-on-a-remote-computer.aspx?CommentPosted=true#commentmessage)strComputer = "atl-fs-01"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService. _
ExecQuery("Select * From CIM_DataFile Where Name = 'C:\\Scripts\\Test.vbs'")If colFiles.Count = 0 Then
Wscript.Echo "The file does not exist on the remote computer."
Else
Wscript.Echo "The file exists on the remote computer."
End If
Thanks,
Homer
I don't wanna do a VBScript today. Have a(n untested) batch:
for /f %%a in (someList.txt) do ( if not exist \\%%a\c$ (>>out.txt echo Failed to access: %%a) else ( if not exist \\%%a\c$\temp\abc.txt ( >>out.txt echo Copying to: %%a md \\%%a\c$\temp copy abc.txt \\%%a\c$\temp\abc.txt ) ) )EDIT: Requires the hidden admin shares, so I'm assuming you haven't killed them and you're not running the Home versions of Windows.
Thanks Razor2.3 once again....it worked exactly as required.... any idea how can I improve performance since it's taking too long even to ping 100 machines....
It's hard to know where the bottleneck is, but you could probably double your performance by cutting the list in half, and running the script on each half at the same time.
Yes.. no problem thank you.... I have already divided 1000 into 500-500.. I have noticed it was taking too much time to figure whether machine was online.. so I am using below steps for quick result..
1. Use VBscript to see which machine online...output.log
2. Run batch to check missing file on ONLY online machines from output.log ...Missingfile.logThanks for all your efforts in understanding and answering queries...
Cheers,
| « How to finis batch script... | what is the extension of ... » |