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

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | No Comment | 499 views | 25/06/2016 17:17

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
 
# Get SQL Availability Replicas
$HostSQLAvailabilityReplica = @($MSSQLServerManager.AvailabilityReplicas)[0]
 
# Get SQL Availability Group Replicas Properties
$HostSQLName = $HostSQLAvailabilityReplica.Name;
$HostSQLAvailabilityReplicaGuid = $HostSQLAvailabilityReplica.UniqueId;
$HostSQLRole = $HostSQLAvailabilityReplica.Role;
$HostSQLAvailabilityMode = $HostSQLAvailabilityReplica.AvailabilityMode;
$HostSQLConnectionModeInPrimaryRole = $HostSQLAvailabilityReplica.ConnectionModeInPrimaryRole;
$HostSQLConnectionModeInSecondaryRole = $HostSQLAvailabilityReplica.ConnectionModeInSecondaryRole;
$HostSQLEndpointUrl = $HostSQLAvailabilityReplica.EndpointUrl;
$HostSQLFailoverMode = $HostSQLAvailabilityReplica.FailoverMode;
$HostSQLJoinState = $HostSQLAvailabilityReplica.JoinState;
$HostSQLQuorumVoteCount = $HostSQLAvailabilityReplica.QuorumVoteCount;
$HostSQLSessionTimeout = $HostSQLAvailabilityReplica.SessionTimeout;
$HostSQLBackupPriority = $HostSQLAvailabilityReplica.BackupPriority;
$HostSQLCreateDate = $HostSQLAvailabilityReplica.CreateDate;
$HostSQLDateLastModified = $HostSQLAvailabilityReplica.DateLastModified;

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


Posted in Windows Powershell | No Comment | 471 views | 07/06/2016 00:12

You can get detailed info about SQL Server Database Replica States via following code:

1
2
3
4
5
6
7
8
9
10
11
12
$MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
 
# Get SQL Database Replica States
$HostSQLDatabaseReplicaState = @($MSSQLServerManager.DatabaseReplicaStates)[0]
 
# Get SQL Database Replica Properties
$HostSQLReplicaGuid = $HostSQLDatabaseReplicaState .AvailabilityReplicaId;
$HostSQLDatabaseID = $HostSQLDatabaseReplicaState .DatabaseID;
$HostSQLAvailabilityReplicaServerName = $HostSQLDatabaseReplicaState .AvailabilityReplicaServerName;
$HostSQLAvailabilityDatabaseName = $HostSQLDatabaseReplicaState .AvailabilityDatabaseName;
$HostSQLReplicaAvailabilityMode = $HostSQLDatabaseReplicaState .ReplicaAvailabilityMode;
$HostSQLReplicaRole = $HostSQLDatabaseReplicaState .ReplicaRole;

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


Posted in Windows Powershell | No Comment | 631 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 | 528 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.


Posted in Windows Powershell | No Comment | 609 views | 24/04/2016 23:25

You can get detailed info about SQL Server Resource Pools 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 Resource Pools
$MSSQLResourcePool = @($MSSQLServerManager.ResourceGovernor.ResourcePools)[0]
 
# Get SQL Resource Pools Properties
$HostSQLResourcePoolName = $MSSQLResourcePool.Name;
$HostSQLMaximumCpuPercentage = $MSSQLResourcePool.MaximumCpuPercentage;
$HostSQLMaximumIopsPerVolume = $MSSQLResourcePool.MaximumIopsPerVolume;
$HostSQLMaximumMemoryPercentage = $MSSQLResourcePool.MaximumMemoryPercentage;
$HostSQLMinimumCpuPercentage = $MSSQLResourcePool.MinimumCpuPercentage;
$HostSQLMinimumIopsPerVolume = $MSSQLResourcePool.MinimumIopsPerVolume;
$HostSQLMinimumMemoryPercentage = $MSSQLResourcePool.MinimumMemoryPercentage;

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


Posted in Windows Powershell | No Comment | 1,026 views | 13/04/2016 13:22

There is no jscript limitation on PoSHServer.

However you need to use escape characters to make it work.

If you need to use something like this:

$(function() { $.ajax({

Then you should change your codes like this:

`$(function() {`$.ajax({

` is a escape character in PowerShell.


Posted in Windows Powershell | No Comment | 286 views | 04/03/2016 14:19

You can get detailed info about SQL Server Role properties via following code:

1
2
3
4
5
6
7
8
9
10
11
$MSSQLServerManager = New-Object 'Microsoft.SqlServer.Management.SMO.Server'
 
# Get SQL Roles
$MSSQLRoles = @($MSSQLServerManager.Roles)[0]
 
# Get SQL Logins Properties
$HostSQLRoleName = $MSSQLRoles.Name;
$HostSQLOwner = $MSSQLRoles.Owner;
$HostSQLIsFixedRole = $MSSQLRoles.IsFixedRole;
$HostSQLCreateDate = $MSSQLRoles.DateCreated;
$HostSQLDateLastModified = $MSSQLRoles.DateModified;

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