UpGrade Posted May 7, 2017 Share Posted May 7, 2017 Hi guys, someone on here must be good with batch file coding, i really need some assistance with something over a LAN network if anyone can help i would really appreciate it Link to comment Share on other sites More sharing options...
Israeli_Eagle Posted May 8, 2017 Share Posted May 8, 2017 What's exactly the problem? Link to comment Share on other sites More sharing options...
UpGrade Posted May 8, 2017 Author Share Posted May 8, 2017 I am trying to create a file to sccm over to a machine on a network where sccm service has stopped, i have completed this successfully but i would like to ad more code so that if you try to connect via pc name and that doesn't work it will do a nslookup on machine name and then grab the ip and try to connect also before this it should ping to see if a connection to the remote machine is possible Link to comment Share on other sites More sharing options...
Dodel Posted May 8, 2017 Share Posted May 8, 2017 10 minutes ago, UpGrade said: I am trying to create a file to sccm over to a machine on a network where sccm service has stopped, i have completed this successfully but i would like to ad more code so that if you try to connect via pc name and that doesn't work it will do a nslookup on machine name and then grab the ip and try to connect also before this it should ping to see if a connection to the remote machine is possible Should get you close. Link to comment Share on other sites More sharing options...
UpGrade Posted May 8, 2017 Author Share Posted May 8, 2017 Thanks thats close to what im looking for but i dont want a text file created i want a user to be able to input a ws name or ip and have it nslookup the inputted data Link to comment Share on other sites More sharing options...
Togijak Posted May 8, 2017 Share Posted May 8, 2017 maybe you find here Batch script for loop & nslookup some help Link to comment Share on other sites More sharing options...
UpGrade Posted May 19, 2017 Author Share Posted May 19, 2017 I also need to create a a script to ping Lots of ips then output the result to a .txt file so far i have this which works great for pinging: @ECHO OFF cls FOR %%i IN ( IP IP IP ) DO ( PowerShell -NoProfile -Command "If (Test-Connection %%i -Count 1 -Quiet) { Write-Host "%%i - Online" -F Green } else { Write-Host "%%i Offline" -F Red | Out-File c:\TEMP\test.txt} ) Pause The problem is i want it to display a name for each ip as they are all assigned to a location and i want it to output that in the .txt file so for example in cmd window it should display: LOCATION 1: 102.3.4.5 LOCATION 2: 102.3.4.5 How can i get the bat file to do that as its pinging ? and then out put it to a txt file or csv importable to excel in a similar format to this: LOCATION 1: 102.3.4.5 - ONLINE LOCATION 2: 102.3.4.5 - OFFLINE Link to comment Share on other sites More sharing options...
Togijak Posted May 19, 2017 Share Posted May 19, 2017 Site: http://www.mirrorcreator.com Sharecode[?]: /files/0HX0SZFK/Batch_File_Programming_-_Premkumar._S.pdf_links Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.