PowerShell SQL Module / Connection



 To get the SQL Module to run correctly on Widows 10 I had to install PowerShell Core Version 6.2.1
 I installed it to C:\Program Files (x86)\PowerShell\6\pwsh.exe
 To get a GUI to operate for scripting in PowerShell 6.2.1 I had to install Visual Studio Code
 To get Visual Studio Code to Default to PowerShell 6.2.1 I had to edit a JSON file and add Code
 In the Visual Studio Code Editor Go To:
 File\Preferences\Settings\Extensions\JSON  ....On Page to the Right Click: "Edit Settings.json" 
 Add the following code or adjust to where you installed PowerShell Core. 
    "terminal.integrated.shell.windows": "C:\\Program Files (x86)\\PowerShell\\6\\pwsh.exe",

# Imports Module I Downloaded and Extracted on my System
Import-Module "C:\Temp\SQL\SqlServer\21.1.18121\SqlServer.psm1"

# Basic Command to Test Auth and Connection to SQL 
Invoke-Sqlcmd -ServerInstance Powershell-PC\SQLExpress -database TEST -Query "Select * from Table_1"    

2020 | Scott W. Head  |  Sr. Systems Admin | Certified Microsoft Windows Server Administrator