I have a need to execute a query in a Powershell script against a SQL server with an alternate user account. I have been using the SQLClient .NET class to create connections and run queries up to now but have not found a method that will allow me to do this with an alternate domain user. It appears the connection string class only implements the userid and password for SQL accounts, not Windows integrated acounts.
I have seen hints on other websites that the SMO objects may allow this but have not yet found a way to incorporate this into a script. Does anyone have any experience with this?
Thanks!