title: Powershell SQL server database connectivity and connection timeout issue
body: <p>I've a powershell script connecting to SQL server 2012 database running a SQL query and result set into data table to send formatted email to relevant parties. Below is the code snippet where issue is:</p>
  
  <pre><code>$CBA = New-Object System.Data.DataSet "CBAData"
  $sqlConn = New-Object System.Data.SqlClient.SqlConnection("Data Source=DataSource;Initial Catalog=DataCatalog;Integrated Security = False;Connection Timeout=800;User ID = user; Password =pwd;")
  $adapter = New-Object System.Data.SqlClient.SqlDataAdapter($CBAData, $sqlConn)
  $adapter.Fill($CBA)
  </code></pre>
  
  <p>I am getting below error running the script:</p>
  
  <pre><code>Exception calling "Fill" with "1" argument(s): "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
  </code></pre>
  
  <p>I've tried increasing timeoutin SqlConnection string from initially set up 360 gradually and now upto 800 but still having same issue. Does anyone throw insight into what exactly issue is here? and How can I overome it?</p>
  
  <p>Thank you in advance.</p>