Troubleshooting PowerShell scripts

You install and upgrade Tridion Sites databases and software components by executing scripts using Windows PowerShell. This topic describes some common troubleshooting steps.

Procedure

  1. Familiarize yourself with the parameters of the script you're about to run. To find out about the script parameters you can specify, open a PowerShell prompt and execute the command get-help SCRIPT -detailed, where SCRIPT is the full path and name of a Tridion Sites PowerShell script.
  2. On a supported Windows machine, click the Start button in the lower-left corner of your screen and type PowerShell in the search box to quickly access and open the Windows PowerShell program.
  3. In PowerShell, navigate to the folder on the installation media that contains the PowerShell script you want to execute.
  4. Enter ls to view the available scripts.
  5. If you are installing or upgrading a database, then note that by default, PowerShell applies timeouts of 10 minutes to your database operations. If you expect this to be insufficient because your database is too large, change the timeout values by setting them as follows:
    $DatabaseScriptConnectTimeout=VALUE
    $DatabaseScriptCommandTimeout=VALUE

    where VALUE is the timeout value in seconds (for example, 3600 sets a 1-hour timeout value).

  6. Run the script. For example, enter the following command to run a database script:
    & '.\Install DATABASENAME database.ps1' 

    where DATABASENAME is the name of the database you are installing.

    If the script filename contains a space or other unsupported character, you need to enclose your script call in a & ' at the beginning and a close quote ' at the end. If the script filename contains no spaces or other unsupported character, the command looks like this:
    .\MyScript.ps1
  7. If you see the error "File SCRIPTNAME.ps1 cannot be loaded because the execution of scripts is disabled on this system", where SCRIPTNAME is the name of the script, then enable the running of PowerShell scripts by entering the following PowerShell command:
    Set-ExecutionPolicy AllSigned
  8. Optional: If you see the error "Could not load file or assembly PATH\Database\Scripts\Tridion.Database.Management.dll or one of its dependencies" when running a database script, where PATH is the installation media path, then open Windows Explorer, navigate to the installation media \Database\Scripts\ folder, select Tridion.Database.Management.dll and click Properties. In the General tab, click Unblock. Click OK to close the dialog. Then restart PowerShell and perform the same steps as before.
  9. Now follow the instructions in the PowerShell console to install or upgrade the database or software component.