rprussell
Posts: 38
Joined: Tue Feb 24, 2009 5:34 pm

Detecting an install to a shared drive?

Hi again -

Quick question - we have to do special processing if our software is installed to a network/shared drive. Is there an easy way to check (Property named "INSTALLINGTOANETWORKEDDRIVE" perhaps?") so that I can conditionally perform the extra processing?

Thanks...

Rob
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Detecting an install to a shared drive?

Hi Rob,

Unfortunately Windows Installer cannot detect a network drive. However, you can try using a custom action to find all network drives and see if the installation path uses one of them.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rprussell
Posts: 38
Joined: Tue Feb 24, 2009 5:34 pm

Re: Detecting an install to a shared drive?

Aha, good lead. Are there any AI tutorials on how to write the VBS file so it's recognized and used and doesn't return

Action ended 10:07:08: FindDrives.vbs. Return value 3.
DEBUG: Error 2896: Executing action FindDrives.vbs failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: FindDrives.vbs, ,
Action ended 10:07:09: WelcomeDlg. Return value 3.
MSI (c) (E4:8C) [10:07:09:049]: Doing action: FatalError

All I have done thus far is copy/paste the code you pointed me at into a file, wrapped it with "Sub FindDrives" and "End Sub" and let 'er rip. I am clueless in this arena.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Detecting an install to a shared drive?

Hi,

Unfortunately we don't have tutorials for creating VBScript files. However, the basic principles are:
1) It is recommended to place the code in functions. For example:

Code: Select all

Function MyFunc()
  'code
End Function
2) The VBS file can be added as a New Attached Custom Action. If it needs access to installer properties, the custom action should be Immediate.
3) If the code uses a function, you can set it the "Function Name" field from the "Custom Action Properties" page (without the parentheses). For example:

Code: Select all

MyFunc
4) If the code doesn't use a function, the "Function Name" field should be empty.

If you followed these guidelines and the problem persists, please send us the AIP and VBS files to support at advancedinstaller dot com so we can investigate them.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rprussell
Posts: 38
Joined: Tue Feb 24, 2009 5:34 pm

Re: Detecting an install to a shared drive?

Thanks - good info again (as always).

How would I reference an MSI property to assign a value?

R
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Detecting an install to a shared drive?

Hi,

In a VBScript custom action you can obtain the value of a property like this:

Code: Select all

value = Session.Property("PROPERTY")
and you can set a property like this:

Code: Select all

Session.Property("PROPERTY") = value
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rprussell
Posts: 38
Joined: Tue Feb 24, 2009 5:34 pm

Re: Detecting an install to a shared drive?

Great! Another one down...

Here's what I ended up with, for others' reference...

Code: Select all

Function NetDrive()
	Dim dr

    Session.Property("IsNetworkInstall") = ""
	dr = Session.Property("APPDIR")

	Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
	Set colDiskDrives = objWMIService.ExecQuery("Select * from Win32_MappedLogicalDisk")

	For each objDiskDrive in colDiskDrives
 	   If InStr(LCase(dr),LCase(objDiskDrive.Caption)) = 1 Then
 		   	Session.Property("IsNetworkInstall") = "1"
	    	Exit For
 	   End If
	Next

End Function

Return to “Common Problems”