In SQL Management Studio there is an option to start PowerShell via right-click on a database (for example).
However, I cannot run queries from that PowerShell session because, it claims, the login fails for my (domain) account.
I am logged in with the same account in Management Studio and started PowerShell from the Management Studio. How can I use the PowerShell session to do anything in SQL Server?
Command I tried was
invoke-sqlcmd "use sometable"
PowerShell then announced that it is using the "provider context" and deduces the SQL server name correctly. But then the query fails because "login failed for user 'mydomain\myaccount'".
What am I doing wrong?