B.1 Connect to GP Repository

Every GP Repository script must connect to a GP Repository to obtain data.

B.1.1 Obtaining the Connection String Value

The connection string is the parameter required to connect to the database.

To obtain this connection string:

  1. Launch the GPA Console from the computer where you are going to execute the script or application.

  2. After connecting to the GP Repository, select the GP Repository node.

  3. On the Action menu, click Properties. The connection string is displayed in the Properties window.

  4. Copy the connection string and paste it into your script or method file.

    NOTE:The connection to the GP Repository is also based on security permissions for the user account in whose context the script or application is executed. Hence, if that user does not have permission to connect to the database, the connection command returns an error.

    If you connect to the database with SQL Server authentication by providing a SQL Server user name and password, then the Connect String window displays the password as “<Password>”. You need to replace this variable with the actual password.

B.1.2 Syntax

Set-GPRConnection [-ConnectionString] <String>

Parameter

Value

ConnectionString

The SQL connection string to the GPA Repository database.

Sample Code

The following sample establishes a connection to the GP Repository database named “GPO_REPOSITORY” on MABOSLPT03.

PS C:\>Set-GPRConnection -ConnectionString "DRIVER={ODBC Driver 13 for SQL Server};SERVER="<SQL Server Instance Name>";Trusted_Connection=Yes;DATABASE=GPO_REPOSITORY;"