VBScript in custom action acting differently - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

anupmistry
Posts: 52
Joined: Tue Jan 12, 2010 6:39 pm

VBScript in custom action acting differently

The installer is creating a temporary file to list all the logical disks on the PC its running. My PC has C: (fixed), D: (cddrive), Z: (mapped network drive). Below is part of the script. PC is a Windows 7 Home Basic.

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDrives = objWMIService.ExecQuery ("Select * From Win32_LogicalDisk")
For Each objDrive in colDrives
Wscript.Echo "Drive letter: " & objDrive.DeviceID & " driveType=" & objDrive.DriveType
if objDrive.DriveType = 4 then
Wscript.Echo "Network path: " & objDrive.ProviderName
end if
Next

So the installer only shows drive C and D when run inside of the advanced installer as a "Begin" custom action. Though if I create a seperate test.vbs file on that PCs desktop with the same script it shows all three drives C, D and Z.

Question is why is the installer dialog not seeing the Z drive (mapped network).

As always thanks for your help.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: VBScript in custom action acting differently

Hi,

The first thing that I noticed to this is script is that it will not run correclt from a MSI package, because it uses the object WScript, which is
not support by Windows Installed. The following article has more details on this subject. You could use "MsgBox" instead of
"WScript.Echo".

Regarding the way the scripts runs, I tested it on a XP machine, made it run in a MSI, and it showed all drivers, including the mapped one. Can you please test this on multiple machines?

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
anupmistry
Posts: 52
Joined: Tue Jan 12, 2010 6:39 pm

Re: VBScript in custom action acting differently

Changed the WScript.Echo to MsgBox in my installer project vbs. Still same results.

Till now have confirmed below ...
1) Windows XP - works fine, shows the network drives correctly
2) Windows 7 - does not work. Tested on Win 7 Home Basic 32 bit, Win 7 Home Premium 64-bit. In both cases if I create a similar script outside of the installer project it shows the mapped drives.

Why do you think the Win 7 is reacting differently? The installer runs as the user who is logged in. The user who is logged in has the mapped drives. So not understanding why its not seeing the mapped drives.

Have sent an email to your support group that contains a sample project depicting the same.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: VBScript in custom action acting differently

Hi,

I tested the sample you sent on XP, Vista and Windows 7. On all machines the drivers were enumerated correctly, including the mapped one.

This problem seems to be related to your machine, I recommend testing on multiple clean ones, virtual machines.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
anupmistry
Posts: 52
Joined: Tue Jan 12, 2010 6:39 pm

Re: VBScript in custom action acting differently

What edition of Win 7 did you try this on?

Win 7 are virtual machines and have been built from scratch. They do not have any other software on them. I see you cannot reproduce though since I am seeing it everytime can you suggest any specific troubleshooting techniques?

My thinking is its not able to see the list of network drives due to role/priviledge/security type of issue. Any other ideas that I can try out. Like get the list of drives maybe using different api.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: VBScript in custom action acting differently

Hi,

Does the modified script still show the drives when launched directly outside your installer? If it does, are you using an Immediate custom action to run it during install? If the problem persists, please send us the .AIP (project) file, the script and a verbose installation log to support at advancedinstaller dot com so we can investigate them.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
anupmistry
Posts: 52
Joined: Tue Jan 12, 2010 6:39 pm

Re: VBScript in custom action acting differently

Sent attachment to support email. Yes using immediate action. Attachment includes several verbose logs. Those marked as Success means the script worked as planned. Those marked as Failure means the script ran but it did not show network mapped drives.

More info about the AI project.
The project has an immediate action for 'listDrives.vbs'. That is executed when user clicks Next on the Welcome Dialog.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: VBScript in custom action acting differently

Hi,

I have tested the setup package you've sent us by e-mail on another Win 7 x64 machine, official release with all updates installed, and it worked on this one too.

This problem is not related to the MSI built by Advanced Installer, we can only suspect that the mapped drivers are not correctly configured on your machines or you are not using the correct
API for your custom action. You can try using another API, or a Win 32 DLL custom action, and also remove the 'if' statement from your code, so you display all drives found on the machine by your code,
maybe it is detected as another type of driver.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
anupmistry
Posts: 52
Joined: Tue Jan 12, 2010 6:39 pm

Re: VBScript in custom action acting differently

Good to know it works on your test PC.

Only reason I was thinking its something in the msi is that the same (similar) script when run independently of the msi works fine on all my test PCs.

Thanks for your help, hoping this problem is not that widespread as we think it is as results are mixed bag.

Return to “Common Problems”