Created
July 12, 2013 16:50
-
-
Save CodeBlueDev/5985928 to your computer and use it in GitHub Desktop.
PowerShell check for SQLPS Module installed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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