Patch/Cmdlets/Misc/Get-SqlServerInstance.ps1
<#
.SYNOPSIS Gets a fully qualified SQL Server instance name in the DatabaseServer\DatabaseInstance format. .DESCRIPTION Gets a fully qualified SQL Server instance name in the DatabaseServer\DatabaseInstance format. .PARAMETER DatabaseServer Specifies the SQL Server database server .PARAMETER DatabaseInstance Specifies the SQL Server instance. #> function Get-SqlServerInstance { param ( [parameter(Mandatory=$true)] [string]$DatabaseServer, [parameter(Mandatory=$false)] [string]$DatabaseInstance = "" ) PROCESS { if($DatabaseServer -eq '.') { $DatabaseServer = "localhost" } $DatabaseServerInstanceName = $DatabaseServer; if (!($DatabaseInstance.Equals("") -or $DatabaseInstance.Equals("MSSQLSERVER"))) { $DatabaseServerInstanceName = "$DatabaseServer`\$DatabaseInstance" } return $DatabaseServerInstanceName } } Export-ModuleMember -Function Get-SqlServerInstance |