Jump to content

Batch File Help


UpGrade

Recommended Posts

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


  • Replies 7
  • Views 1.1k
  • Created
  • Last Reply

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


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


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


  • 2 weeks later...

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


Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...