Posted in
Windows Powershell |
No Comment | 961 views | 15/02/2016 15:09
You can get SQL Server Endpoint information via following code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| $MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
# Get SQL Endpoints
$MSSQLEndpoint = @($MSSQLServerManager.Endpoints)[0]
# Get SQL Endpoint Properties
$HostSQLEndpointName = $MSSQLEndpoint.Name;
$HostSQLEndpointType = $MSSQLEndpoint.EndpointType;
$HostSQLProtocolType = $MSSQLEndpoint.ProtocolType;
$HostSQLOwner = $MSSQLEndpoint.Owner;
$HostSQLEndpointState = $MSSQLEndpoint.EndpointState;
$HostSQLIsAdminEndpoint = $MSSQLEndpoint.IsAdminEndpoint;
$HostSQLIsSystemObject = $MSSQLEndpoint.IsSystemObject; |
$MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
# Get SQL Endpoints
$MSSQLEndpoint = @($MSSQLServerManager.Endpoints)[0]
# Get SQL Endpoint Properties
$HostSQLEndpointName = $MSSQLEndpoint.Name;
$HostSQLEndpointType = $MSSQLEndpoint.EndpointType;
$HostSQLProtocolType = $MSSQLEndpoint.ProtocolType;
$HostSQLOwner = $MSSQLEndpoint.Owner;
$HostSQLEndpointState = $MSSQLEndpoint.EndpointState;
$HostSQLIsAdminEndpoint = $MSSQLEndpoint.IsAdminEndpoint;
$HostSQLIsSystemObject = $MSSQLEndpoint.IsSystemObject;
You can also check other properties by listing all properties of $MSSQLEndpoint.