/build/static/layout/Breadcrumb_cap_w.png

error 170

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   [ + ] Show comments

Answers (7)

Posted by: akhlaque 19 years ago
Orange Senior Belt
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.
Posted by: TomB 19 years ago
Orange Belt
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.
Posted by: urban_diver 19 years ago
Orange Senior Belt
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,
Posted by: MSIPackager 19 years ago
3rd Degree Black Belt
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.
Posted by: akhlaque 19 years ago
Orange Senior Belt
0
yes urban thats wat i told u that u please check where u r writing the custom action.
I mean the sequencing.
Posted by: urban_diver 19 years ago
Orange Senior Belt
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
Posted by: MSIPackager 19 years ago
3rd Degree Black Belt
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ