Thursday, August 13, 2015

Open-SSMS function. Open SSMS using powershell command prompt.

Open SQL Server Management Server using powershell command prompt.


Since working with powershell while now. I got use to open all the tools using powershell command line. I have below list function.
Open-SSMS {
[CmdletBinding( DefaultParameterSetName='Ins-Que' )]
param(
[Parameter( Position=1,
Mandatory=$false,
ValueFromPipelineByPropertyName=$true,
ValueFromRemainingArguments=$false )]
[ValidateSet("2012", "2014")]
[string]
$version="2014"
)
if ($version -eq "2014")
{
Invoke-Item "C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Ssms.exe"
}
if ($version -eq "2012")
{
Invoke-Item "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe"
}
} #Open-SSMS
view raw Open-SSMS.ps1 hosted with ❤ by GitHub

No comments:

Post a Comment