Scott Wheeler

Fully automating SW Image Installations (What SolidWorks doesn't tell you...)

Discussion created by Scott Wheeler on Mar 23, 2018
Latest reply on May 20, 2019 by Scott Wheeler

This will hopefully save some fellow CAD Admins and users headaches, since a lot of these details aren't well documented and only learned through trial & error.

 

Our particular installation scenario is for 90+ users across multiple sites with the majority of SolidWorks software packages installed, including PDM, Electrical, all the Simulations, Composer, Inspection,etc.  We have a shared Toolbox folder within the PDM Vault, which adds complexity to the install process, and I also have a handful of users who only use E-Drawings as a viewer, but still need access to PDM Vault files.  In past years this was a manual roll out, where the Admin Image was configured and e-mails were sent to users for them to click on hyperlinks and run the install (.hta) file.  The challenge with this was ensuring users actually do the install, and then users have to wait 1-3 hours for an install to complete.

 

This year we automated this process, so as soon as the servers are updated we push the install out.  This results in users simply leaving their computers running, logged in, screen locked at the end of the day.  With the scripts below the installations happen off hours and are 100% hands-free.  For a user base as large as ours, this is a great approach to take, but does require some specific setup steps.

 

 

So the basics I assume most CAD admins would know..but here's to putting all relevant info in one thread/spot.  Download the desired version/service pack installer and then run.  I strongly recommend selecting the option to download all files versus a straight up install at this point.  Once downloaded, you can then create an Admin Image.  I first create the Admin Image on my local drive while I'm developing and testing.  (i.e. C:\SW Images\2018)  Once testing is complete, use RoboCopy to confidently copy all files to a shared network folder for distribution purposes.  Note, all users will need at least read-access to this network folder location.  Read-Write is not needed, but if that permission is enabled it allows you to see log files for each computer the image was installed on.  (That can be useful to debug a failed install.)

 

Some suggestions on the Admin Image settings to avoid headaches.

  • Make your Global settings the "Default" installation you'd want for any computer.  This allows any computer to have SW installed without being listed in a specific Group in your admin image.
    • For some, default would best be only the core SolidWorks files and then Groups could be created for additional add-ins to be installed on designated computers.
    • For others, Global Settings should be a default where full SolidWorks and all add-ins are installed. This is less maintenance initially and over time as computers come and go.
  • For Client Installation Options, check "Do Not Activate Automatically".  Odds are you have a SolidNetWork License Manager if you are trying to automate the installation process on many computers, and are not upgrading machines with static licenses.
  • For Administrative Options, check Run a Program after installation and point it to your BAT file.(see below)  Also check "Yes, I want to join" for participating in the Customer Experience.  This allows you to use the CAD Admin tool in the SolidWorks Customer Portal.
  • For the Toolbox/Hole Wizard options, set this folder to C:\Temp.  (This is temporary, since in our case the Toolbox is a shared folder in the PDM Vault)

 

 

I prefer to install SolidWorks outside of an image install on my sandbox computer, but the image could be used at this point to for the first install.  Once installed, open and run the SolidWorks software, take time to configure all the various settings, such as File Locations for templates, any menu customization's, etc.  Do not simply copy last year's CopySettingsWizard sldreg file.... this is bad practice.  It's well documented oddball errors occur when doing this, where options are added, removed, or moved within menus.  I find it works best to have two computers running side by side and evaluate the options to see what is new.  Also, set the Add-Ins to your desired preference for how you want users to initially run SolidWorks.

 

Once you are happy with all this, then use the Copy Settings Wizard to create and save a new .sldreg file to a designated folder.  I create a folder for all my custom files, again locally before copying to a network folder (C:\SW Images\MySettings\)  Now, make a copy of this .sldreg file and remove the 'sld' portion of the filename, which I save as swSettings2018.reg.  This makes it a standard reg file which you can then just add to a computer to push the settings.

Note - I'm well aware that in 2017 SolidWorks added functionality to push and lock (if desired) these customizations found in the Copy Settings Wizard.  However, in 2017 there were many bugs with this and in 2018SP2 some bugs were fixed while several others were created.  It simply is not reliable and a major headache to avoid for now...

 

Go to RegEdit and export Computer\HKEY_CURRENT_USER\Software\SolidWorks\AddInsStartup, save in MySettings\AddInStartup.reg

 

So at this point you have your Admin Image files in one folder and two .reg files in another.  Now a BAT file is needed to start tying it together.  Create a BAT file by just renaming a .txt file to .bat, save in MySettings folder, and using Notepad to create and modify the contents.  Here is my "Run After.BAT" file and I'll explain each line's function:

 

@echo off

echo .

echo .

echo .     *******************************************************

echo .     *  Applying <company name> custom SolidWorks settings. *

echo .     *         Please do not close this window!            *

echo .     *******************************************************

echo .

echo .

So this section above just displays on the CMD window what is going on.  This BAT file runs after the SW Image has completed the install, so the Installer window is still up at 100% install and then this BAT file runs.

 

: Install Custom Properties add-in

: Copy files

xcopy /s /i /q /y "\\corp.companyname.com\Global SW Deployment\SolidWorks\EhCanadian Consulting, Inc" "C:\Program Files\EhCanadian Consulting, Inc"

: Register the DLL

cd /d C:\Windows\Microsoft.NET\Framework64\v4.0.30319

RegAsm.exe "C:\Program Files\ehcanadian Consulting, Inc\Copy Properties\CopyProperties.dll" /codebase /s

: Push Registry Keys

START /WAIT REGEDIT /s "\\corp.companyname.com\Global SW Deployment\SolidWorks\MySettings\HKCU Copy Properties.reg"

START /WAIT REGEDIT /s "\\corp.companyname.com\Global SW Deployment\SolidWorks\MySettings\HKLM Copy Properties.reg"

This above section is for installing a custom API that we had developed externally, but this applies for any API.  A few things to take note of.

  • The API's install files are copied with XCOPY from a network folder to the user's local folder with certain switches enabled
  • Network folder paths use the UNC folder path, not a mapped letter folder path.  (You can't guarantee your users will have the same mapping.)

 

: Push custom SolidWorks Settings

START /WAIT REGEDIT /s "\\corp.companyname.com\Global SW Deployment\SolidWorks\MySettings\swSettings2018.reg"

This section is pushing the reg file created from the CopySettingsWizard. 

 

: Set status of add-ins in SolidWorks

START /WAIT REGEDIT /s "\\corp.companyname.com\Global SW Deployment\SolidWorks\MySettings\AddInStartup.reg"

This section pushes the status of all the SolidWorks Add-Ins.  This is useful, because the Image Install offers no control, and by default will enable certain add-ins.  For example, Inspection is always enabled.  It depends on the add-in, SolidWorks does not universally set add-ins on or off.  If you have floating licenses, this is a great way to specify an initial status of add-ins.

 

: Set ToolBox Location to PDM Vault

reg add "HKEY_CURRENT_USER\Software\SolidWorks\SOLIDWORKS 2018\General" /v "Toolbox Data Location" /t REG_SZ /d "C:\EPDM\SW Tool Box" /f

Recall in the Admin Image the Toolbox was set to C:\Temp.  Why?  Because if the installer is done with the Toolbox pointing to a PDM Vault folder it will trigger a PDM login and halt the installer process.  By telling the installer to use a non-Vault folder, the PDM login dialog never pops up.  This registry add re-points the Toolbox folder to the PDM Vault folder.

 

: Set Last Open Folder

reg add "HKEY_CURRENT_USER\Software\SolidWorks\SOLIDWORKS 2018\General" /v "Last user path" /t REG_SZ /d "C:\EPDM" /f

This is a small nitpick, but a variety of settings in SolidWorks are based on the Last Used folder or selection.  When you export your CopySettingsWizard it also grabs the Last Opened Folder setting.  Rather than have all my users initially opening files in my test environment folders, I default this to the PDM Vault root folder.

 

: Reboot computer

echo .

echo .

echo .     *******************************************************

echo .     *      SolidWorks installation was successful.        *

echo .     *      Computer will now restart in 30 seconds.       *

echo .     *******************************************************

echo .

echo .

timeout /t 5

shutdown.exe /r /t 25

This last section simply forces a reboot at the end of the installer process.  The timeout allows the command window to be displayed for the status, and then 25 seconds are allowed to pass before the forced restart is executed.

 

The last key to the puzzle is pushing the install process itself.  We use our Active Directory database to push to a group of computers with the current version of SolidWorks installed.  Another BAT file should be created with the two items below in it to successfully push an install.

reg add "HKCU\Software\SolidWorks\Applications\PDMWorks Enterprise\Security" /v "EULA Accepted 2018 18 2 %COMPUTERNAME%" /t REG_SZ /d "Yes"

The first command is needed to avoid having a user accept the End User License Agreement dialog box that pops up during the install process.  Note it is specific to the version of software and the Computer name.

"\\corp.mycompany.com\Global SW Deployment\SolidWorks\2018\startswinstall.exe" /install /now /showui

The last command  is the actual command to launch the SW Image installer.  It forces the install to occur immediately, and shows the installation dialgox box.  The only reason to show the UI for an automated install script like this is when something goes wrong.  The user comes back to their computer expecting the update to be done, and if it gets stuck somewhere at least there is some visible clue as to where it got stuck and that something isn't right.

 

That's about it.  Hopefully some of these tips help out some folks!

Outcomes