How to connect to SQL Server LocalDB using Invoke-Sqlcmd?

后端 未结 4 2002
猫巷女王i
猫巷女王i 2021-02-20 11:39

I have sqlcmd.exe from both SQLServer 2008 and SQLServer 2012:

PS C:\\> Get-Command sqlcmd.exe

Definition
----------
C:\\Program Files\\Microsof         


        
4条回答
  •  有刺的猬
    2021-02-20 12:00

    Got this from a couple other sources, seems to work so far.

    JBs Powershell

    and

    How can I run PowerShell with the .NET 4 runtime?

    Another way of making PowerShell and LocalDB play nice is to make PowerShell aware of DOTNET 4.0.3. This can be done by creating a file called "powershell.exe.config" in the C:\Windows\System32\WindowsPowerShell\v1.0 . The file should contain the following:

    
     
          
               
               
          
    
    

    Be aware that this not an officially supported way of using PowerShell, so it might break other stuff ...

提交回复
热议问题