Access SQL Server (Integrated Security) with Different Windows Credentials in PowerShell

Access SQL Server (Integrated Security) with Different Windows Credentials in PowerShell

I needed to get data out of a SQL Server instance that used integrated windows security through a PowerShell script. But the user that has access to the instance is a domain user account different to the user logged on when running the script. So I developed a mechanism to invoke my SQL commands as a script block of a job because a job can be started with different credentials.

You can find below my PowerShell script that connects to a SQL database using different Windows credentials, runs a query and format the result as a table. This is provided as an example to illustrate this mechanism. You can especially use this mechanism to replace SQL integration pack activities of Orchestrator.

Leave a Reply

Your email address will not be published. Required fields are marked *