-1

I want to share my setup directory in installshield. I did some search and found a VB Script and a CMD Command:

      Option Explicit

      Const FILE_SHARE = 0
      Const MAXIMUM_CONNECTIONS = 25

      Dim objShare

      'Connect to WMI
      Dim objWMIService: Set objWMIService = _
      GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

      'Query share names for existing share
      Dim colShares: Set colShares = objWMIService.ExecQuery _
      ("Select * from Win32_Share Where Name = 'MyShare'")

      'Delete share if one exists with the same name already
      For Each objShare in colShares
      objShare.Delete
      Next

      'Create new share
      Dim objNewShare: Set objNewShare = objWMIService.Get("Win32_Share")
      Dim strFilePath: strFilePath = Session.Property("CustomActionData")
      strFilePath = Left(strFilePath, Len(strFilePath) - 1)
      objNewShare.Create strFilePath, "MyShare", _
      FILE_SHARE, MAXIMUM_CONNECTIONS, "MyShare"

cmd command:

net share sharename=[INSTALLDIR]

When i run VBScript i don't see any error but I can't share my folder. When i run cmd command, command can't share because it requires admin privilege; but I am not sure, how i can provide admin privilege to it; can i share folder? how?

Amit Shakya
  • 1,396
  • 12
  • 27
Dr Sima
  • 135
  • 1
  • 12

2 Answers2

1

Try. You need to have access rights on location that you are trying to share.

net share Share=E:\Shared /Grant:Everyone,full

Note: You can change the share rights based on your need. This is strictly an example.

Amit Shakya
  • 1,396
  • 12
  • 27
  • but it dont work when i run cmd.exe without run as adimin . i have an error that say access is denied , i cant run cmd.exe run as admin with installshield application – Dr Sima Nov 28 '17 at 10:42
  • you have to call this command as a batch using elevated command prompt programmatically. https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator/18037959#18037959 – Amit Shakya Nov 28 '17 at 11:20
0

i found a very simple solution. i went in file and folders tab and right clicked on installdir an then in sharing tab i checked Share Folder check box and Finish! Very Simple Without code and Command!

Dr Sima
  • 135
  • 1
  • 12
  • But how will you do that using installShield as an installer. You can not sit on all the machines and share the path manually. – Amit Shakya Nov 28 '17 at 10:23
  • i dont share manually, in installshield there is a tab with name file and folders under this tab i can right click on installdir and check share folder check box,when i install the program installshield share folder. – Dr Sima Nov 28 '17 at 12:36
  • 1
    @AmitShakya, in InstallShield, while on the "Files and Folders" view, right click the folder under the Destination Computer tree view and click Properties. There will be a Sharing tab where you can check the box for "Share this folder on the network", set the share name, the number of simultaneous users, whether users can edit the files, and which InstallShield component to place it under. It looks remarkably similar to the Windows folder properties share dialog but it is in face in InstallShield. – StalePhish Apr 23 '20 at 13:25