Server.PingSqlServerVersion Server.PingSqlServerVersion Server.PingSqlServerVersion Method

Definition

Gets the version number of the instance of SQL Server.

Overloads

PingSqlServerVersion(String, String, String) PingSqlServerVersion(String, String, String) PingSqlServerVersion(String, String, String)

Get the version number of the specified instance of SQL Server using the specified login and password to gain access.

PingSqlServerVersion(String) PingSqlServerVersion(String) PingSqlServerVersion(String)

Gets the version number of the instance of SQL Server.

PingSqlServerVersion(String, String, String) PingSqlServerVersion(String, String, String) PingSqlServerVersion(String, String, String)

Get the version number of the specified instance of SQL Server using the specified login and password to gain access.

public:
 Microsoft::SqlServer::Management::Common::ServerVersion ^ PingSqlServerVersion(System::String ^ serverName, System::String ^ login, System::String ^ password);
public Microsoft.SqlServer.Management.Common.ServerVersion PingSqlServerVersion (string serverName, string login, string password);
Public Function PingSqlServerVersion (serverName As String, login As String, password As String) As ServerVersion
Parameters
serverName
String String String

A String value that specifies the name of the instance of SQL Server.

login
String String String

A String value that specifies the login.

password
String String String

A String value that specifies the login password.

Returns
Microsoft.SqlServer.Management.Common.ServerVersion Microsoft.SqlServer.Management.Common.ServerVersion Microsoft.SqlServer.Management.Common.ServerVersion

A Microsoft.SqlServer.Management.Common.ServerVersion object value that specifies the version of the instance of SQL Server.

Examples

C#

Server srv = new Server("(local)");  
Console.WriteLine(srv.PingSqlServerVersion("(local)", "SampleLogin", "SampePassword"));  

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)", "SampleLogin", "SamplePassword")  
Write-Host $srv.PingSqlServerVersion("(local)")  

PingSqlServerVersion(String) PingSqlServerVersion(String) PingSqlServerVersion(String)

Gets the version number of the instance of SQL Server.

public:
 Microsoft::SqlServer::Management::Common::ServerVersion ^ PingSqlServerVersion(System::String ^ serverName);
public Microsoft.SqlServer.Management.Common.ServerVersion PingSqlServerVersion (string serverName);
Public Function PingSqlServerVersion (serverName As String) As ServerVersion
Parameters
serverName
String String String

A String value that specifies the name of the instance of SQL Server.

Returns
Microsoft.SqlServer.Management.Common.ServerVersion Microsoft.SqlServer.Management.Common.ServerVersion Microsoft.SqlServer.Management.Common.ServerVersion

A Microsoft.SqlServer.Management.Common.ServerVersion object value that specifies the version of the instance of SQL Server.

Examples

C#

Server srv = new Server("(local)");  
Console.WriteLine(srv.PingSqlServerVersion("(local)"));  

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")  
Write-Host $srv.PingSqlServerVersion("(local)")  

Applies to