/bundles/itninjaweb/img/Breadcrumb_cap_w.png
Hi,

i have a problem with creation daemon tool, the problem is that i need some how do that that after installing it it takes as virtual drive example V:\ drive, so is it posible to manage that in the MSI file. On PC could be some different drives posible but many of them and the V:\ drive is not used, so is it posible to do that?
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
Reading between the lines, I *think* you're asking how to determine which drive is free to map a share to? Here's some ancient code I used to use. It doesn't fit my current specifications for script code but it does the job:

lstrDummy = strGetNextAvailableDrive(lstrDrive)

If lstrDummy = "" Then
'// Display an error and bail
Else
lstrDrive = lstrDummy
End If

Private Function strGetNextAvailableDrive(ByVal lstrShare)
'********************************************************************
'*
'* Gets the next drive letter available from OS to map to a share
'*
'* Input: lstrShare the name of the share to map drive to
'*
'* Output: None
'*
'* Returns: strGetNextAvailableDrive the drive letter to map to
'*
'********************************************************************

On Error Resume Next

Dim lintDrive
Dim fso

Set fso = CreateObject("Scripting.FileSystemObject")

For lintDrive = 26 To 5 Step -1
If blnTryMapDrive(lintDrive, lstrShare) Then
Exit For
End If
Next

If lintDrive <= 5 Then
strGetNextAvailableDrive = ""

strMsg = "Unable to verify availability of " & lstrShare
Else
strGetNextAvailableDrive = Chr(lintDrive + 64) & ":"
End If

Set fso = Nothing

On Error Goto 0

End Function

Private Function blnTryMapDrive(ByVal lintDrive, ByVal lstrShare)
'********************************************************************
'*
'* Attempts to map a network drive
'*
'* Input: lintDrive an integer between 5 and 26
'* lstrShare the name of the share to map drive to
'*
'* Output: None
'*
'* Returns: True if mapping successful
'* False if not
'*
'********************************************************************

On Error Resume Next

Dim lstrDrive
Dim fso

Set fso = CreateObject("Scripting.FileSystemObject")

lstrDrive = Chr(lintDrive + 64) & ":"

blnTryMapDrive = False

' don't bother on existing drive, because that will DEFINITELY fail!
If Not fso.DriveExists(lstrDrive) Then
On Error Resume Next

objWshNetwork.MapNetworkDrive lstrDrive, lstrShare
If blnErrorOccurred(" occurred in mapping network drive") = False Then
blnTryMapDrive = True
End If
End If

Set fso = Nothing

On Error Goto 0

End Function
Answered 12/15/2010 by: VBScab
Red Belt

Please log in to comment
0
thank you for replay, but the problem is that i dont know the next drive wich is free, so i thogt that there is some other posibility to add neded drive with out knowing the numbers of allredy existing drives.
Answered 12/15/2010 by: lanselots
Fifth Degree Brown Belt

Please log in to comment
0
The code I sent you is the shell of a script which will do exactly that. It loops through all the drives starting with Z and ending with Eand attempts to map a drive to the sharename passed in to the function. If it succeeds, the drive letter is returned by the function.
Answered 12/15/2010 by: VBScab
Red Belt

Please log in to comment