cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
igz_dwd_12
Level 3

VB script not executing

I want to create a url shortcut in programme folder.
So i planned to write a vb script and pass it
custom action during installation>After setup complete Success dialogue.
Here is my VB script

set WshShell = WScript.CreateObject("WScript.Shell")
user=WshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
set oUrlLink = WshShell.CreateShortcut(user+ "\\Start Menu\\Programs\\yahoo" & "\yahoo.url")
oUrlLink.TargetPath = "http://yahoo.com/"
oUrlLink.Save


When i run this script manually it works perfect.
Can any body figure out where is problem.IS it is my script problem ot custom action or any thing else?

I also tried to add simple message box in my script but it does not pop.(Means script not execute)
But when i run example scrip from
http://kb.flexerasoftware.com/doc/Helpnet/isxhelp16_sp1/ISXVBSCAExample.htm

It works perfect in custom action.

thanks!
0 Kudos
(4) Replies
bharath_k_s
Level 7

Hello,

I see that you are using WScript Object in you script. The WScript object cannot be used inside a script custom action because this object is provided by the Windows Script Host. The Installer runs Script Custom Actions directly and does not use the Windows Script Host. Objects in the Windows Script Host object model can only be used in custom actions if Windows Script Host is installed on the computer by creating new instances of the object, with a call to CreateObject, and providing the ProgId of the object (for example "WScript.Shell"). Depending on the type of script custom action, access to some objects and methods of the Windows Script Host object model may be denied for security reasons.

Hence VBScript Custom Action is failing.

Thanks,
Bharath
0 Kudos
igz_dwd_12
Level 3

Thanks Sir!
Then what changes to made in my script to do it wok!
0 Kudos
bharath_k_s
Level 7

Hello,

Could you replace Wscript.CreateObject with CreateObject and check if the VBScript runs successfully.

For Example: Wscript.CreateObject("some.object", "Another-parameter") replace this with CreateObject("some.object", "Another-parameter")


Thanks,
Bharath
0 Kudos
igz_dwd_12
Level 3

Thanks!
I create a c# programme to create url link.
And replace it instead of vb script.
It is working fine now!
0 Kudos