Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Check if Servername is in Textfile

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,38266
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Check if Servername is in Textfile
  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 if Servername is in Textfile - 10/2/2006 12:14:18 AM   
  kuehnlm

 

Posts: 19
Score: 0
Joined: 8/21/2006
Status: offline
Hi all,

I'm new to vbscript and I was searching in the internet for the last hour...but didn't find the right thing. :(

I have got a txt-file with that:
server1,c, e
server2,c,d
server3,d
server4,c
server5,c

I'm reading the txt-file with an array - that works fine. At the moment it is not a dynamically array - but that does not matter at all.
I'm running the script on several servers - locally. If the servername is in the txt-file I have to execute a executable, if the servername is not in the txt-file I just want to write a entry into a logfile.

I don't know what to do and how to read the txt-file.

Can anybody please help me?
Thanks in advance.
Mel
 
 
Post #: 1
 
 RE: Check if Servername is in Textfile - 10/2/2006 1:05:22 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
do a search for "file system object", that will help with your file manipulations

if it was me, for a quick and dirty thing, I'd just do an instr() for the server name line by line

once you find the name, use the wscript.shell object to execute your application

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to kuehnlm)
 
 
Post #: 2
 
 RE: Check if Servername is in Textfile - 10/2/2006 1:31:03 AM   
  kuehnlm

 

Posts: 19
Score: 0
Joined: 8/21/2006
Status: offline
got it - thanks for your help.


(in reply to kuehnlm)
 
 
Post #: 3
 
 RE: Check if Servername is in Textfile - 10/2/2006 4:42:52 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
I would probably do a readall then use instr to see if the server name is in the list.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to kuehnlm)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Check if Servername is in Textfile Page: [1]
Jump to:





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