During Installation I need to append few values to the existing file.

For example

Two entries needs to appended during installation in the below mentioned file.

File: C:\WINDOWS\system32\drivers\etc\services

Entries:
knetd 2053/tcp
man 9535/tcp

How can we do this using WISE.
0 Comments   [ + ] Show 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.

Answers

0
you can create a custom action, that calls a exe file created by wse script.

first create the exe file, then add it in the msi file, as a binary file then call it using a Custom action, but be aware ot also create a uninstallation script.

/fetgor
Answered 02/16/2006 by: fetgor
Senior Purple Belt

Please log in to comment
0
Here are two vbscript custom actions that can be used:

CustomAction_AddToHostsFile
Condition: NOT Installed AND NOT REMOVE~="ALL"
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(objShell.ExpandEnvironmentStrings("%windir%") & "\SYSTEM32\Drivers\etc\services.",8)
objFile.WriteLine "knetd 2053/tcp"
objFile.WriteLine "man 9535/tcp"
objFile.Close



CustomAction_RemoveFromHostsFile
Condition: REMOVE~="ALL"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objFile = objFSO.OpenTextFile(objShell.ExpandEnvironmentStrings("%windir%") & "\System32\drivers\etc\services.", 1)
strContents = objFile.ReadAll()
objFile.Close
strOldText = "knetd 2053/tcp"
strOldText2 = "man 9535/tcp"
strNewText =""
strContents = Replace(strContents, strOldText, strNewText)
strContents = Replace(strContents, strOldText2, strNewText)
Set objFile = objFSO.OpenTextFile(objShell.ExpandEnvironmentStrings("%windir%") & "\System32\drivers\etc\services.", 2)
objFile.Write strContents
objFile.Close
Answered 02/17/2006 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity