Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
Check Host
Logged in as: Guest
arrSession:exec spGetSession 2,16,48234
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
Post a VBScript
>> Check Host
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
Check Host -
6/12/2007 9:34:05 PM
4scriptmoni
Posts: 190
Score: 0
Joined: 5/3/2007
Status:
offline
A simple .bat to check hosts from a .txt file.
@REM This script Checks Connection of IPs @REM By Felipe Ferreira 18/04/2007 @echo off :: Check Syntax and OS IF NOT "%OS%"=="Windows_NT" GOTO Syntax :: Check command line ECHO.%1 | FIND "?" >NUL IF NOT ERRORLEVEL 1 GOTO Syntax IF [%1]==[] GOTO Syntax :: Check if TXT file exists IF NOT EXIST "%~f1" GOTO Syntax :: Keep variables local SETLOCAL ::DEFINE VARIABLES (logfile) del ipslog.TxT /q set logfile=ipslog.TxT :: Read variables from command line @REM Get the Filename + Path of passed argument SET TXTFile="%~f1" @rem set email=fferreira@attiva.biz :Run cls @echo. @echo Retriving Servers from %TXTFile% please wait... @echo. :: Search the TXT file line by line FOR /F "tokens=* delims=" %%A IN ('TYPE %TXTFile%') DO CALL :ParseINI "%%A" @echo Finished Reading %TXTFile% GOTO End :Syntax ECHO. ECHO. ECHO ECHO Pass a IP list .txt with one IP per or host per line ECHO Example: checkips.bat list.txt ECHO. @ECHO By Felipe Ferreira [email=fferreira@attiva.biz]fferreira@attiva.biz[/email] (HP) 29/03/07 updated %DATE% ECHO. pause :End @echo Command Completed @echo Output on the logfile : %logfile%. pause notepad %logfile% @REM Clean Variables ENDLOCAL set IPS= set logfile= ::===== Go thru .TXT and set each line to a variable and execute; === :ParseINI SET IPS="%~1" ::Clean the quotes from the servername SET IPS=%IPS:"=% :: Do the CMD ECHO Checking SERVER : %IPS% set ERRORLEVEL=0 @REM RUNS THE WHOIS COMMAND PING %IPS% | FIND "TTL=" >NUL IF ERRORLEVEL 1 @ECHO #ERROR connecting to %IPS% >> %logfile% IF ERRORLEVEL 1 @ECHO ##KO IF NOT ERRORLEVEL 1 @ECHO Server %IPS% OK >> %logfile% IF NOT ERRORLEVEL 1 @ECHO **OK
cheers,
Felipe
_____________________________
Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net
Revisions: 1
|
Post #: 1
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[Scripting]
>>
Post a VBScript
>> Check Host
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI