search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | 1 Comment | 5,066 views | 11/05/2016 15:42

You can get detailed info about SQL Server Availability Group Listeners via following code:

1
2
3
4
5
6
7
8
9
10
$MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
 
# Get SQL Availability Group Listener
$HostSQLAvailabilityGroupListener = @($MSSQLServerManager.AvailabilityGroupListeners)[0]
 
# Get SQL Availability Group Listener Properties
$HostSQLName = $HostSQLAvailabilityGroupListener.Name;
$HostSQLAvailabilityGroupListenerGuid = $HostSQLAvailabilityGroupListener.UniqueId;
$HostSQLIPAddresses = $HostSQLAvailabilityGroupListener.AvailabilityGroupListenerIPAddresses;
$HostSQLPortNumber = $HostSQLAvailabilityGroupListener.PortNumber;

You can also check other properties by listing all properties of $HostSQLAvailabilityGroupListener.


Posted in Windows Powershell | No Comment | 1,958 views | 05/05/2016 16:39

You can get detailed info about SQL Server Availability Groups via following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
 
# Get SQL Availability Groups
$HostSQLAvailabilityGroup = @($MSSQLServerManager.AvailabilityGroups)[0]
 
# Get SQL Availability Groups Properties
$HostSQLAvailabilityGroupName = $HostSQLAvailabilityGroup.Name;
$HostSQLAvailabilityGroupID = $HostSQLAvailabilityGroup.Id;
$HostSQLAvailabilityGroupGuid = $HostSQLAvailabilityGroup.UniqueId;
$HostSQLLocalReplicaRole = $HostSQLAvailabilityGroup.LocalReplicaRole;
$HostSQLAutomatedBackupPreference = $HostSQLAvailabilityGroup.AutomatedBackupPreference;
$HostSQLFailureConditionLevel = $HostSQLAvailabilityGroup.FailureConditionLevel;
$HostSQLPrimaryReplicaServerName = $HostSQLAvailabilityGroup.PrimaryReplicaServerName;
$HostSQLHealthCheckTimeout = $HostSQLAvailabilityGroup.HealthCheckTimeout;

You can also check other properties by listing all properties of $HostSQLAvailabilityGroup.