I am finding a discrepancy between Powershell ISE and Powershell running under the Administrator account.
My script contains a number of connections to SQL, all of which work without issue under ISE.
However, when executing from a Powershell prompt, a number of the SQL connections fail with the error: Exception calling Open with 0 argument(s): The ConnectionString property has not been initialized.
The code which is failing is as follows:
$connectionDB = New-Object System.Data.OleDb.OleDbConnection $connectionDetailsDB
$command22 = New-Object System.Data.OleDb.OleDbCommand $SQLConfigOptions, $connectionDB
This format is used consistently throughout the script so the only difference appears to be the Powershell environment under which it executes.
As always, any pointers appreciated!