Some cursory research here: Command-Line Deployment - 2022 - SOLIDWORKS Installation Help
Indicates that this is structured similarly to AutoDesk with the concept of Administrative Images but alternatively a Command Line install. We’re interested in the Command Line install:
The reason we want to avoid using administrative images is because every time an update comes out you have to recreate that image, which is super time consuming.
What you’ll learn when you watch it create the image is that it is simply copying all of the data from one folder to your target folder and then simply manipulating an ini/xml file to contain the parameters you specified.
Then that config file is ingested by a Setup.exe bootstrapper which ultimately feeds those parameters to a silent installer.
So let’s start by following the instructions on command line deployment instead of Administrative Image
As you can see there are a series of prerequisites that need to be installed. Luckily Immy can install prereqs:
You have a choice here, because even though Immy can install prereqs, SolidWorks may only work with the specific version of the prereqs contained in their package whereas Immy is going to try to install the latest version of each. Further, there may be prereqs that Immy doesn’t have, like Bonjour.
Since the prereqs are included in the package already, you might as well just use them. We do something similar in our Quickbooks install script.
Once the prereqs are installed, the installer is less likely to prompt the user.
They are even nice enough to give you the relative paths to the prereq and optional MSIs within the package: MSI File Locations for Administrative Images - 2022 - SOLIDWORKS Installation Help
As well as a list of all MSI properties available for overriding on the command line:
Command-Line Global Properties - 2022 - SOLIDWORKS Installation Help
Feeling lazy and armed with some unique search strings like SOLIDWORKSSERIALNUMBER I headed off to Github and searched for SOLIDWORKSSERIALNUMBER and filtered the results to PowerShell
SCCM-Application-Deployment-Scripts/Deploy-Application.ps1 at 368550cb6679129380ba7764aa6d70d771009c11 · bciu22/SCCM-Application-Deployment-Scripts (github.com)
Where crossan007 did the hard work for us. Here’s the meat of it:
Execute-Process -Path "$dirFiles\64bit\OfficeWeb_11\owc11.exe" -Parameters "/quiet"
Execute-Process -Path "$dirFiles\64bit\Microsoft_C++_2005_Redistributable_(x64)\vcredist_x64.exe" -Parameters "/Q"
Execute-Process -Path "$dirFiles\64bit\Microsoft_C++_2005_Redistributable\vcredist_x86.exe" -Parameters "/Q"
Execute-Process -Path "$dirFiles\64bit\Microsoft_C++_2008_Redistributable_(x64)\vcredist_x64.exe" -Parameters "/Q"
Execute-Process -Path "$dirFiles\64bit\Microsoft_C++_2008_Redistributable\vcredist_x86.exe" -Parameters "/Q"
Execute-Process -Path "$dirFiles\64bit\Microsoft_C++_2010_Redistributable_(x64)\vcredist_x64.exe" -Parameters "/Q"
Execute-Process -Path "$dirFiles\64bit\Microsoft_C++_2010_Redistributable\vcredist_x86.exe" -Parameters "/Q"
Execute-Process -Path "$dirFiles\64bit\Microsoft_C++_2012_Redistributable_(x64)\vcredist_x64.exe" -Parameters "/Q"
Execute-Process -Path "$dirFiles\64bit\Microsoft_C++_2012_Redistributable\vcredist_x86.exe" -Parameters "/Q"
Execute-Process -Path "$dirFiles\64bit\.Net_Framework_4.5.2\NDP452-KB2901907-x86-x64-AllOS-ENU" -Parameters "/Q"
#Execute-MSI -Path "$dirFiles\64bit\Microsoft_VSTA\vsta_aide.msi"
Execute-Process -Path "$dirFiles\64bit\VSRemoteDebugger\install.exe" -Parameters "/Q"
Execute-MSI -Path "$dirFiles\64bit\Microsoft_VBA\vba71.msi"
Execute-MSI -Path "$dirFiles\64bit\Microsoft_VBA_1033\vba71_1033.msi"
Execute-MSI -Path "$dirFiles\64bit\Bonjour\Bonjour64.msi"
## <Perform Installation tasks here>
Execute-MSI -Path "$dirFiles\64bit\SOLIDWORKS\SOLIDWORKS.msi" -AddParameters "INSTALLDIR=""C:\Program Files\SolidWorks"" ADDLOCAL=SolidWorks SERVERLIST=""[email protected]"" SOLIDWORKSSERIALNUMBER=""xxxx xxxx xxxx xxxx xxxx"" OFFICEOPTION=3 ENABLEPERFORMANCE=0"
Now, he is using the PowerShell App Deploy Toolkit which contains helper methods like Execute-Process and Execute-MSI. The corollaries in Immy are Start-ProcessWithLogTail and Install-MSI, respectively.
With a minor amount of massaging, I’m pretty confident we can turn this into a generic installer for SolidWorks products.