![]() ![]() Launch a new PowerShell shell using "run as a different user" and use the appropriate credentials from the remote forest (assuming the forest trusts facilitate doing this).Which brings me to some simple alternatives to worrying about the connection string: ![]() When you leverage the integrated authentication option, the credentials of the host process are used. $secureStringPwd = Read-Host -assecurestring "Please enter your can't specify alternate Windows credentials in a connection string. $username = Read-Host "Enter your username" $ds.Tables | Out-File -FilePath C:\file.csv $ConnectionString = "Server=" -f $ServerInstance,$Database,$ConnectionTimeout to the beginning of the script but have been unsuccessful in getting this to work.Ĭan anyone tell me how I might modify my working script to accommodate this change? I am pretty certain my connection string needs to be modified but I can't get it to work. I have added the $username = Read-Host "Enter your username" (Example B) etc. The problem arises when I try to connect to a SQL server in a separate domain - since PS by default uses the creds of the logged on user, I am not sure of how to work around this. From there I can run a query and output the results to a file. ![]() I have a working script (Example A) which allows me to connect to SQL servers in my current domain using windows authentication. I am new to PowerShell and would really appreciate some help! ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |