/build/static/layout/Breadcrumb_cap_w.png

Problems inserting vbscript AND wisescript CustomAction

Trying to get a fix out there.

I have a vbscript to unmap a few drives and a Wisescript to delete some files. I had both inserted in ExecuteImmediate, after InstallInitialize and only the wisescript was successfully executed. I moved vbscript CA to Execute deferred, before InstallFinalize, but got the same result.

When the vbscript and Wisescript were individually added to the MSI they worked properly, and obviously when I manually run each script they run properly.

What am I missing here?

0 Comments   [ + ] Show comments

Answers (10)

Posted by: urban_diver 18 years ago
Orange Senior Belt
1
Try this.

Set oShell = CreateObject("WScript.Shell")
Set oNetwork = CreateObject("WScript.Network")

dr = "j:"
oNetwork.RemoveNetworkDrive dr, True, True
drv = "q:"
oNetwork.RemoveNetworkDrive drv, True, True
Posted by: urban_diver 18 years ago
Orange Senior Belt
0
I'd like to take a look at the VBScript
Posted by: Bladerun 18 years ago
Green Belt
0
Sloppy, but I was in a hurry and found this in my achive of "back-in-the-day-when-i-thought-i-could-code" codes.

Set oShell = WScript.CreateObject("WScript.Shell")
Set oNetwork = WScript.CreateObject("WScript.Network")

dr = "j:"
oNetwork.RemoveNetworkDrive dr, True, True
drv = "q:"
oNetwork.RemoveNetworkDrive drv, True, True
Posted by: urban_diver 18 years ago
Orange Senior Belt
0
Try this:


Option Explicit
Dim objNetwork, strDriveLetter
strDriveLetter = "J:"

Set objNetwork = CreateObject("WScript.Network")
' Section which removes strDriveLetter
objNetwork.RemoveNetworkDrive strDriveLetter
Wscript.Quit
Posted by: urban_diver 18 years ago
Orange Senior Belt
0
If I remember correctly, Wise doesn't like :
Set oShell = WScript.CreateObject ("WScript.Shell")

Remove WScript from CreateObject

Set oShell = CreateObject ("WScript.Shell")
Posted by: Bladerun 18 years ago
Green Belt
0
No dice.

I modified the vbscript as suggested, and it still didn't yank the network drives.


EDIT: actually I just modified it as mentioned in your second post. Let me try the first modification.

EDIT 2: yeah, didn't work either way. Could it be the CA placement in the sequence?
Posted by: urban_diver 18 years ago
Orange Senior Belt
0
If you run the vbscript manually, it executes successfully? How are you running the vbscript? Call VBScript from Embedded code? Call VBScript from Installation? Call VBScript from Installed Files?
Posted by: Bladerun 18 years ago
Green Belt
0
Yes, it runs properly when I double click the .vbs file.

I'm trying to add this script as a custom action and its not executing properly, so let's put it this way.

How should i be running this? It doesn't matter to me when it runs, as long as it runs.

(I'm using Wise.)
Posted by: Bladerun 18 years ago
Green Belt
0
THANK YOU.

That worked. The vbscript and Wisescript both now work.



Reason number 3412352346232 why I need a better grasp of vbscript. Thanks again.
Posted by: mgroover 18 years ago
Senior Yellow Belt
0
sorry for being really anal about the coding but to be 100% correct.. (blablabla)

undeclare the objects aswell..

Set oNetwork = Nothing
Set oShell = Nothing

This should be "best-practice" always when coding to not muck up the system. Never trust the Windows Scripting Host.. [:D]

// martin
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
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