Analysis – Concurrent Connections to Web Front End – SharePoint 2013

If you are intereted to find the number of connections on your WFE and want to analyze later you can use the script below.  This script will run every 5 minutes
$FilePath = "E:\Scripts\Connections.csv"
$Content = Get-Content $FilePath -ErrorAction SilentlyContinue
$String = ""
if($Content.Length -eq 0)
{
    $Header="Server,Date,Time,Connections`r`n"
    $String = $Header
}
$Date = Get-Date -Format d
$Time = Get-Date -Format t
Get-WmiObject -Class Win32_PerfFormattedData_W3SVC_WebService -ComputerName Server1,Server2,Server3,Server4 | Where {$_.Name -eq "_Total"} | % `
{
    $ServerName = $_.__SERVER;
    $Connections = $_.CurrentConnections
    $String +="`r$ServerName,$Date,$Time,$Connections"
    Write-Host "$ServerName : $Connections" 
}
Out-File -InputObject $String $FilePath -Encoding ascii -Append -Force 

Scheduled Task XML

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2015-08-20T15:54:47.5695947</Date>
    <Author>Domain\UserName</Author>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <Repetition>
        <Interval>PT5M</Interval>
        <Duration>P1D</Duration>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2015-08-20T15:22:04</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>Domain\UserName</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
 <Actions Context="Author">
    <Exec>
      <Command>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</Command>
      <Arguments>-ExecutionPolicy Bypass E:\Scripts\Update-CSVForConnections.ps1</Arguments>
    </Exec>
  </Actions>
</Task>
One you set it up in task schedular it will write to CSV every 5 minutes which you can take out in Pivot chart todo an analysis.

image

This can show you how your WFEs are performing at different times of day.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s