PS_CABenchMark

Save this script as PS_CABenchMark.ps1 then call after setting server name, no changes should be necessary.

Copy / Paste only works with Chrome or newer versions of Internet Explorer. A line feed/character return problem corrupts the script if copied using Internet Explorer 8 or lower.


$Server = "SVR01"
$SQLConnectionPrimary = New-Object System.Data.SqlClient.SqlConnection
try
{
    $SQLConnectionPrimary.ConnectionString = "Server=" + $Server + ";Database=DB_Name;Integrated Security=True ;"
    $SQLConnectionPrimary.Open()
}
catch{throw "Error : Connection to Primary server cannot be established"}

$SQL = 
"
DELETE FROM dbo.TimingResults;

DECLARE @RC int
DECLARE @Cycles_IO int
DECLARE @Cycles_CPU int
DECLARE @CycleDepth int
DECLARE @TestCase varchar(50)
DECLARE @StressLevel int
DECLARE @Initialize bit

EXECUTE @RC = [dbo].[sp_HeartBeat] 
   @Cycles_IO = 100
  ,@Cycles_CPU = 10
  ,@CycleDepth = 1
  ,@TestCase = 'CA BenchMark'
  ,@StressLevel = 3
  ,@Initialize = 1
"

$SQLCommand = New-Object System.Data.SqlClient.SqlCommand($SQL, $SQLConnectionPrimary)
$SQLCommand.CommandTimeout=65535
$SQLCommand.ExecuteScalar()
$SQLConnectionPrimary.Close()


%d bloggers like this: