/bundles/itninjaweb/img/Breadcrumb_cap_w.png
I'm running the following script as a custom action

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")
WindowsFolder = oShell.ExpandEnvironmentStrings("%WinDir%")
'Set f = fso.OpenTextFile("C:\WINDOWS\system32\drivers\etc\services", ForAppending, True)
Set f = fso.OpenTextFile(WindowsFolder & "\system32\drivers\etc\services", ForAppending, True)
'Set f = fso.OpenTextFile(System.Property("SystemFolder") & "drivers\etc\services", ForAppending, True)
f.WriteLine "otsl_ar_ep 4290/tcp"
f.WriteLine "otsl_ep 4295/tcp"
f.WriteLine "otsl_a_ep 4296/tcp"
f.WriteLine "otsl_rp 6002/tcp"
f.Close

When I run this script externally, it works fine. But when I try to run it as a custom action I get the 1720 error.
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
Hi Urban:

Where u r writing the custom action i think there lies the problem.
i mean in the sequencing. which version of windows installer do u hav?
The custom action which u r using must reture 0 value to be successful.
Answered 09/27/2005 by: akhlaque
Orange Senior Belt

Please log in to comment
0
If you install the package with verbose logging "/l*v" the log output should give you the line in which the error is in and more information on the error.
Answered 09/27/2005 by: TomB
Orange Belt

Please log in to comment
0
This is the error information message in the event viewer:

Product: PAS -- Error 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action Add Entries to Services File script error -2146827864, Microsoft VBScript runtime error: Object required: 'oShell' Line 5, Column 4,
Answered 09/27/2005 by: urban_diver
Orange Senior Belt

Please log in to comment
0
When I run this script externally, it works fine. But when I try to run it as a custom action I get the 1720 error.

Where are you running the custom action - Execute Immediate / Deferred? Try sequencing it in Execute Deferred after Start Services... Also, ensure you are running it in the System Context.

Hope it helps,
Rob.
Answered 09/27/2005 by: MSIPackager
Third Degree Black Belt

Please log in to comment
0
yes urban thats wat i told u that u please check where u r writing the custom action.
I mean the sequencing.
Answered 09/27/2005 by: akhlaque
Orange Senior Belt

Please log in to comment
0
Apparently Wise doesn't like or understand "Set oShell". I changed that line to Set fso1 and it worked fine. This is the modified script:

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set fso1 = CreateObject("WScript.Shell")
WindowsFolder = fso1.ExpandEnvironmentStrings("%WinDir%")
'Set f = fso.OpenTextFile("C:\WINDOWS\system32\drivers\etc\services", ForAppending, True)
Set f = fso.OpenTextFile(WindowsFolder & "\system32\drivers\etc\services", ForAppending, True)
f.WriteLine "otsl_ar_ep 4290/tcp"
f.WriteLine "otsl_ep 4295/tcp"
f.WriteLine "otsl_a_ep 4296/tcp"
f.WriteLine "otsl_rp 6002/tcp"
f.Close
Answered 09/27/2005 by: urban_diver
Orange Senior Belt

Please log in to comment
0
Weird... can't say I've heard of that one before!

Ou of interest how come you have bothered with

Dim fso, f

If you didn't for oShell or fso1 ? You've not bothered with Option Explicit so why worry about declaring variables?

Cheers,
Rob.
Answered 09/27/2005 by: MSIPackager
Third Degree Black Belt

Please log in to comment