<img height="1" width="1" src="https://www.facebook.com/tr?id=1529264867168163&amp;ev=PageView &amp;noscript=1">
blog_listing_hero_img.jpg

Automating Jetstress 2013 for Exchange 2013 – Part 2

In part 2 we initiate the Jetstress, stress the disk subsystem for a period of 2 hours, and analyze the result. We then will display the result for the users. Once the Jetstress is completed, the script also uninstalls the application for you.  

Finally we consolidate all these functions defined in the article into a single script and call the functions to perform appropriate action. We also talk about the simple execution process and analyzing the result files.

Initialize Jetsstress.exe and start stress test for 2 hours.

#function to start Jetstress

Function startjetstress()

{

Cd "C:\Program Files\Exchange Jetstress"

Invoke-Expression " ./JetstressCmd.exe /?"

Sleep 10

Write-host –f green “Starting Jetstress test”

Invoke-Expression "./JetstressCmd.exe /c c:\temp\jetstress\jetstress.xml /timeout 2H0M0S /new"

}

 

For the first time, Jetstress needs to be initialized. It will register all dll’s and supporting files, was copied on to the Exchange Jetstress directory.       

 

Validate Jetstress result file and display the result.

 

#function to verify Jetstress results

Function Verifyjetstressresults()

{           $result = 1

Write-host –f green “Verifying Jetstress Result:”

if ((test-path("c:\temp\jetstress\jetstressresults\per*html"))) 

            {

          $result_file = dir c:\temp\jetstress\jetstressresults\per*.html

        $results = get-content $result_file

                    If ($results -match "<td class=`"success`">Pass</td>")

                        {             $result = 1                    }

                        Else

                        {           $result = 0                      }

            }

            Else

            {           Write-host –f red “Could not find result file”

            }

             Return $result

    }

Once Jetstress is completed, the script will automatically verify the Jetstress file - performance*.html from the directory c:\temp\jetstress\jetstressresults and displays the result status on the PowerShell window. 

 

 Uninstall Jetstress, if Jetstress is successful

            #function to uninstall Jetstress

Function uninstalljetstress()

            {   msiexec /qn /x "C:\temp\JetStress\Jetstress.msi" | get-process       }

 

 

Once the Jetstress is completed and validated and if the Jetstress result is successful, then it will uninstall the Jetstress application. If not, it will not uninstall Jetstress, as you may want to rerun the stress test.

 

We are almost done with the script. Now, we just have to call each of the above functions to perform an individual task. Use the below code to call the above function one by one and to verify the Jetstress files, DB mount points, install Jetstress, stress and finally validate Jetstress result.

 

To have a complete PowerShell script, copy each of the above functions in the same order to a temp file and finally copy the below code at the end of functions and save the file as “Jestress.ps1” at the folder path “C:\Temp\Jetstress\”

 

Note: Make sure that you execute the Windows PowerShell in “Run as administrator” mode, so that, you have all necessary permissions to install and perform Jetstress on the local server.

 

Write-host  -f green “*********************************************************`n”

Write-host  -f green “      Welcome to Exchange 2013  -Jetstress 2013 `n"

Write-host  -f green “*********************************************************”

Write-host  -f darkmagenta "                                             -Krishna Kumar"

If (Verifyjetstressfiles)

{           Write-host -f Magenta “`nAll Jetstress required files has been validated” }

else

{          

            Write-host -f red “One or more Jetstress files is not available, please validate and rerun the script”

            Exit; }

 

If(Verifydiskconfig)

{           Write-host -f Magenta “`nNecessary Mount points are configured”   }

Else

{ Write-host -f red “One or more disk mount points is not configured, please configure and rerun the script”

            Exit }

 

Write-host -f green “`nInstalling Jetstress application”

installjetstress

startjetstress

Write-host -f magenta “`nJetstress test completed, validating the Jetstress result”

 

If(Verifyjetstressresults)

{           Write-host –f green “Jetstress has been successfully completed “

            Uninstalljetstress  }

Else

{           Write-host –f green “Jetstress has been failed, verify the result file for more details “ }

 

Write-host -f green “`n ****** End of Exchange 2013 -Jetstress 2013 ******* `n"

 

 

 

Executing Jetsress.ps1 script

Start the powershell application by “Run as Administrator”; change the directory path to C:\Temp\Jetstress and execute the file Jetstress.ps1. Below figure 8 has details of the same.  Script will validate the Jetstress.msi and supporting files, DB path, and installs jetstress.

 kk2.1

Figure 1. Installing Jetstress

Finally, once Jetstress is installed and verified, it performs the stress test on disk subsystem. It validates the Jetstress result once stress test is completed and displays the result on the screen. You can find all the result files under c:\temp\jetstress\jetstressresults for manual analysis purpose.

kk2.2                              

Figure 2. Starting Jetstress Test

 

 

Conclusion:

Automating Jetstress is necessary for large scale deployment. Sometimes, you really cannot do a perfect job when you deploy in large scale and it’s the time where automation comes into picture.  Automation of Jetstress helps you to stress all mailbox servers with ease. It is important to perform Jetstress on all mailbox servers before moving to production and it would be a serious risk, if the server is moved to production without Jetstress. 

I am sure this script will come in handy in your deployment and in production. Happy Jetstress 2013!