I am getting following error for invoke-bulkCopy
Exception calling "WriteToServer" with "1" argument(s): "Login failed for user 'userName'"
I am trying to supply database server info and not an active connection to invoke-bulkCopy (invoke-bulkCopy anyways does not take an connection parameter)
It generates a connection string by creating a new-connection object using the supplied parameters and uses this to generate a new-object Data.sqlClient.sqlBulkCopy with connectionString as parameter.
This connection is immediately closed in next line.
Now bulkCopy operation has a connection String that is created above doesn't hold a password value. I am supplying Password when I call the function. ConnectionString when pass doesn't hold password, could this be creating an issue? You can check the
Tried modifying code at my end to supply new created connection $connection in the function as a paramter when $bulkCopy is created rather than passing $connectionString and closed connection after the bulkCopy is called i.e. after
Is this the right way to do?
Please get back with some examples.