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

knetd 2053/tcp
man 9535/tcp

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


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.

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

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

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"

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()
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
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