What to do when you install a new version of PowerShell?
- Written by David Corrales
- Last Updated: 19 April 2016
- Created: 25 February 2013
- Hits: 5753
Some of you may have already encountered this. You upgraded your system to PowerShell V3 and you asked how do I get PrimalScript or PowerShell Studio to recognize the new version of PowerShell? This article addresses that very question. You can accomplish this by following the steps outlined below. This article will also cover the case where you add a new module or snapin as well.
Updating PrimalScript & PowerShell Studio:
Step 1: Registering the dependent controls.
You will need to register the dependent PowerShell controls for the product. Depending on if the correct PowerShell version was present when you initially installed the product, it might be necessary to re-register the controls. This can be done by running RegisterControls.exe. This executable is located in the same directory as the application:
C:\Program Files\SAPIEN Technologies, Inc\PrimalScript [YEAR]\RegisterControls.exe
C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio [YEAR]\RegisterControls.exe
When the above window appears, check the relevant versions of PowerShell to register and press OK.
Note: The RegisterControls.exe updates both products, so you need only run it once.
Step 2: Update the Cache
Once the appropriate PowerShell controls are registered, you also need to update the PowerShell cache used by both applications.
Note: You need only update the cache in one application, since both products share the same cache information.
Update the Cache in PrimalScript:
1. Access the Options via the File menu:
2. In the Options window go to the Text Editor->PrimalSense category and press the “Clear Cache” button.
3. The cache will automatically rebuild. You may need to restart PrimalScript in order to see the changes.
Update the cache in PowerShell Studio:
1. Go to the PowerShell Browser located in the Object Browser Panel and press the Refresh button.
Now you are ready to use the new version of PowerShell in your favorite SAPIEN IDE.
Here are some other situations you may encounter as well:
Installing New Modules or Snapins:
If you install a new module or snapin, you will need to rebuild the cache as described in Step 2 in order to view the cmdlets in both products.
Importing External Caches:
There might be times when you will need to write a script on your local machine that is designed to run on a server which has modules and cmdlets you do not have locally. For this very reason, PrimalScript and PowerShell Studio allow you to import external cache profiles from servers and provide PrimalSense support for those external cmdlets. Please refer to the following article for more details: