Skip to content

Instantly share code, notes, and snippets.

@CodeBlueDev
Created July 12, 2013 16:50
Show Gist options
  • Save CodeBlueDev/5985928 to your computer and use it in GitHub Desktop.
Save CodeBlueDev/5985928 to your computer and use it in GitHub Desktop.
PowerShell check for SQLPS Module installed.
$sqlpsreg = "HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps";
if (Get-ChildItem $sqlpsreg -ErrorAction "SilentlyContinue")
{
throw "SQL Server Provider for Windows PowerShell is not installed."
}
else
{
$item = Get-ItemProperty $sqlpsreg
$sqlpsPath = [System.IO.Path]::GetDirectoryName($item.Path)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment