1

I'm installing SQL Server Data Tools (among other things) with a PowerShell script.

The relevant part is a simple:

& "\\mynetworkpath\installer.exe"

or

Start-Process "\\mynetworkpath\installer.exe"

if I feel like getting fancy with install arguments.

The problem is the first thing that pops up says "Choose Directory For Extracted Files"

When I run my script it picks an install location,

C:\Windows\SysWOW64\SSDTBI_x86_ENU\x86\setup\

What I want is for it to generate an install location like during a manual install. If I just right click the installer and run as admin it generates:

E:\e369a6f811046fa831f81e12\

That directory name is different every time I install though.

jdope
  • 115
  • 2
  • 14
  • For what it's worth: SSDT/DacFX is available as a NuGet now https://www.nuget.org/packages/Microsoft.SqlServer.DacFx.x64/ – gvee May 17 '17 at 16:04
  • "The first thing that pops up says "Choose..." - is this a silent install? Or is the script launching the installer wizard? – Jelphy May 17 '17 at 16:06
  • 1
    And a more direct answer to your question: check the _switches_ available to your particular installer. run this, for example: `& "\\mynetworkpath\installer.exe" -?` – gvee May 17 '17 at 16:06
  • @Jelphy It will eventually be a silent install once I get this part figured out. For now it just launches the install wizard. – jdope May 17 '17 at 16:11
  • @gvee `& "\\mynetworkpath\installer.exe" -?` seems to just launch the installer. It eventually errors and says **'-?' is not a valid value for setting 'FEATURES'.** – jdope May 17 '17 at 16:13

2 Answers2

3

The directory name is likely a parameter set by the installer.

To see the switches for your installer:

\\mynetworkpath\installer.exe --help
\\mynetworkpath\installer.exe /? or -?

You could try generating a log file, if your .exe supports this, e.g.:

installer.exe /Log=C:\MyLog.txt

..and checking the log file for the relevant 'set directory' property. If you discover the parameter name, you can pass it as an argument in your script.

This link has more details on .exe command line options: How can I find out if an .EXE has Command-Line Options?

Community
  • 1
  • 1
Jelphy
  • 961
  • 2
  • 11
  • 28
  • Is there a reason why that wouldn't work? I get `'-?' is not a valid value for setting 'FEATURES'.` and the same for `/?` – jdope May 17 '17 at 16:41
  • It should display the relevant help for your installer. Open PowerShell in the directory where installer.exe is, try installer.exe /? or installer.exe --help (other variations may work). – Jelphy May 17 '17 at 16:49
  • I cd to the directory and run `installer.exe /?` and `installer.exe -?`, and `-help`. All three say "The term 'installer.exe' is not recognized as the name of cmdlet, function, ...etc. – jdope May 17 '17 at 17:06
  • 1
    Try ./installer.exe /? – Jelphy May 17 '17 at 17:29
  • That did work to give me the info. So I can see how to change the directory for a bunch of stuff. Nothing is clearly the install directory, but I can research that. I'll also try to check out a log file. Do you have any idea why running it through PowerShell and just regular would generate a completely different install directory originally? It just seems very strange considering I'm not giving it any parameters. – jdope May 17 '17 at 19:06
  • Not sure why the install directory is changing. You could experiment with Start-Process and pass the install directory parameter to -ArgumentList when you find it. Does sound like strange behaviour though. – Jelphy May 17 '17 at 20:58
2

PowerShell is going off its default directory when you run the script. I don't know why it picks E:\ when you run it through Windows, but there must be some special configuration in your operating system to cause it to do that.

Regardless, the solution is simple: change directory to E:\ before you call the installer:

cd E:\
& "\\mynetworkpath\installer.exe"
coinbird
  • 1,202
  • 4
  • 24
  • 44