/bundles/itninjaweb/img/Breadcrumb_cap_w.png
Hi everyone,
Can anyone advise on how to write a vb script to add a string of texts to the services file in a package.

For example--I have an application called Figtree and i want it to add the following into the services file to any pc that i install the msi package on ("sequentially")

i.e:- XXXserver 2501/tcp #svr db
Figtree server 2502/tcp #svr db
XXXserver2 2503/tcp #svr db

You can see that the figtree server details have a value of 2502/tcp which comes after 2501 and precedes 2503.

I need a script to include in the custom actions table using wise installer to inclde the figtree server details during installation.

Thanks guys
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
Have a search through the forums, as this has been discussed and solutions posted previously.
Answered 09/19/2006 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
0
Sorry to be thick , but could not find any as i've searched before posting
Answered 09/19/2006 by: noodles187
Orange Belt

Please log in to comment
0
Try this link: [link]http://itninja.com/question/installshield-vs-wise-for-repackaging40&mpage=1&key=hostsຜ[/link]
Answered 09/19/2006 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
0
Thanks Mr. B hunter, but that post really does not say much, i'm sure the guy who posted it also did not get anything out of the replies
Answered 09/19/2006 by: noodles187
Orange Belt

Please log in to comment
0
Sorry, it was this part I was referring to:

set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.opentextfile("myhost.txt")
file.writeline "myhost1...."
file.close


So to append a line of text to your services file, the script should look like this:

set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.opentextfile("c:\windows\system32\drivers\etc\services.", 8)
file.writeline "db2 3700/tcp #Required for DB2"
file.close
Answered 09/19/2006 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
0
Thanks B hunter, Thats worked
Answered 09/20/2006 by: noodles187
Orange Belt

Please log in to comment
0
Thanks B hunter, Thats worked
Answered 09/20/2006 by: noodles187
Orange Belt

Please log in to comment
0
Hi Noodles,

I used this vbscript to write to a file....
See if this is of some help to you...................

Option Explicit
On Error Resume next

Dim fso
Dim WinDirPath
Dim PathToHosts, PathToServices
Dim iReturnValue
Const TAB = " "
Set fso = CreateObject("Scripting.FileSystemObject")
WinDirPath = fso.GetSpecialFolder(0)
PathToHosts = WinDirPath & "\system32\drivers\etc\hosts" ' path to file
PathToServices = WinDirPath & "\system32\drivers\etc\services"

iReturnValue = WriteToFile (PathToHosts, "127.0.0.1","localhost","","")
iReturnValue = WriteToFile (PathToServices, "qotd","17/tcp","quote","#Quote of the day")


Set fso = Nothing

'--------------------------------------------------------------------------------------------------
' Description :Function to write to file
' Return Value :1 if changes made
' 0 if file doesnt exist
'--------------------------------------------------------------------------------------------------
Function WriteToFile (ByVal pathToFile,byval para1,byval para2,byval para3,byval para4)
Dim TempFile
Dim msg

If fso.FileExists(pathToFile) Then

Set TempFile = fso.OpenTextFile(pathToFile,8,True)
msg = para1 & TAB & para2 & TAB & para3 & TAB & TAB & para4
msg = rtrim(msg)
MsgBox(msg)
TempFile.WriteLine msg
TempFile.Close
Set TempFile = Nothing
WriteToFile = 1

Else
WriteToFile = 0
End If

End Function
Answered 09/21/2006 by: DevGowda
Orange Belt

Please log in to comment