Posted in
Windows Powershell |
No Comment | 2,128 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; |
$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 | 2,359 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:
Then you should change your codes like this:
` is a escape character in PowerShell.