kennyp
Level 2

"Custom Actions" to include my script

Created a VBscript :

dim filesys, filetxt
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("C:\Windows\System32\drivers\etc\services", ForAppending, True)
filetxt.WriteLine("sapmsERP 3601/tcp")
filetxt.WriteLine("sapmsEP0 3601/tcp")
filetxt.WriteLine("sapmsAP0 3602/tcp")
filetxt.WriteLine("sapmsGPW 3630/tcp")
filetxt.WriteLine("sapmsAT1 3603/tcp")
filetxt.WriteLine("sapmsGPA 3600/tcp")
filetxt.WriteLine("sapmsERT 3600/tcp")
filetxt.Close

I seem to be missing a step, I am unable to configure my package to write the entries to C:\Windows\System32\drivers\etc

Thank You
Kennyp
Labels (1)
0 Kudos
2 Replies
CHANDINATHREDDY
Level 7

Hi I have modified your code to so .
and its is working.
only thing is how you add to custom action.
what i have done is
in coustom action create an new custom action that is installed with the product and schedule to run in excute sequence after install finalize. and its working
///////////////////////////////////////////////////////////////////////////////////////////////////
dim filesys, filetxt
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("C:\Windows\System32\text.txt", ForAppending, True)
filetxt.WriteLine("sapmsERP 3601/tcp")
filetxt.WriteLine("sapmsEP0 3601/tcp")
filetxt.WriteLine("sapmsAP0 3602/tcp")
filetxt.WriteLine("sapmsGPW 3630/tcp")
filetxt.WriteLine("sapmsAT1 3603/tcp")
filetxt.WriteLine("sapmsGPA 3600/tcp")
filetxt.WriteLine("sapmsERT 3600/tcp")
filetxt.Close
///////////////////////////////////////////////////////////////////////////////////////////////////
0 Kudos
CHANDINATHREDDY
Level 7

And one more thing is services is not an text file it is an type of file so you were not able to write it.
0 Kudos