IBM Support

Checking the PowerShell connection to MS SQL server

Question & Answer


Question

How can you check the ability of PowerShell to make a connection to the Microsoft SQL server

Cause

There have been cases where PowerShell commands to the SQL server have failed, either during backups or when running a script such as the front end capacity dsmfecc-01.ps1 script. Some of those failures have been found to occur when PowerShell fails to make a connection to the SQL server.

Answer

To check that the Powershell commands are connecting to the SQL server start the PowerShell command line and issue the commands below

    PS C:\Users\Administrator> $conn = New-Object System.Data.SqlClient.SqlConnection                                      
    PS C:\Users\Administrator> $conn.ConnectionString = "Server=(local);Database=ADD-YOUR-DB-NAME;Integrated Security=True;"                                                                        
    PS C:\Users\Administrator> $conn.Open()

replace ADD-YOUR-DB-NAME with the actual name of the SQL database on the host machine. If Powershell is able to connect to the SQL server, then the final command above will not display a result, it will just return to the PS command line. If there is a failure then the command will output an error.

The PowerShell error will need to be pursued with Microsoft support as it is independent of the IBM Spectrum Protect software.

[{"Product":{"code":"SSTFZR","label":"Tivoli Storage Manager for Databases"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Data Protection for MS SQL","Platform":[{"code":"PF033","label":"Windows"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB26","label":"Storage"}}]

Product Synonym

TSM

Document Information

Modified date:
17 June 2018

UID

swg21980343