Script to check the performance of your SharePoint Online Requests

I’d like to share with you a little script that i’m always using at customers for checking the response time of my Modern SharePoint sites. What you have to do is to change the Path, EndDate and Urls to have results in your CSV ๐Ÿ™‚ Enjoy!

$pat = "C:\Users\GokanOzcifci\Documents\SharePoint\SPOPerformance.csv"
$endDate = "05 May 2019 14:20:00"
$urls = "",

$array = @()
$tim = Get-Date
while($tim -lt $endDate)
    foreach($url in $urls)
        $ie = New-Object -comobject "InternetExplorer.Application"
        $ie.visible = $true
        $timein = Get-Date
        while ($ie.Busy -eq $true -or $ie.ReadyState -ne 4 -or $ie.document.IHTMLDocument3_getElementByID("O365_MainLink_Settings").readystate -ne "complete") 
        {Start-Sleep -Seconds 1}

        $timeout = Get-Date
        $array += New-Object PSObject -Property @{Url = $url;TimeIn = $timein;TimeOut = $timeout; Duration= $timeout - $timein}
        Write-Host ($timeout - $timein)  $url 

    start-sleep -seconds 30
    $tim = Get-Date

$array | Export-Csv -Path $pat

and here is the result. I could see as an example that the root site opening is faster and a specific document library.

I own a company and work a lot with #SharePoint. Entrepreneur. Microsoft Regional Director and @MVPAward for Office Servers and Services.

5 comments On Script to check the performance of your SharePoint Online Requests

  • Hi Gokan, tx for sharing the script. I tested the script, it’s launches MSIE as expected, unfortunately the script doesn’t continue. The MSIE windows stays open, only 1, though 2 urls in the list and no output written to SPperformance file. Can I/you add some code for debugging?

    • Hey Eric,

      Strange – just to be sure, did you adjust the time in the $endDate? If you stop the script before the $endDate ; then nothing happens.. Be sure that the $endDate is reached and that VS Code stops by it self to get results…

      Can you please retest – and share me the results at There is always room for improvement, if you want to add – edit some code always glad to add it and credit it for you ๐Ÿ™‚

      • Hi Gokan, tx for the prompt reply. in my case the script stays in loop3 for an indefinite time as the condition remains ‘true’, any idea what we can add/change to the condition? Tx & brgds.
        while ($ie.Busy -eq $true -or $ie.ReadyState -ne 4 -or $ie.document.IHTMLDocument3_getElementByID(“O365_MainLink_Settings”).readystate -ne “complete”)
        write-host “loop3”
        Start-Sleep -Seconds 1

        • Thatโ€™s what iโ€™m saying, he needs an endtime โ€“ and not an condition thatโ€™s indefinite ๐Ÿ™‚

          • Hi Gokan, running the script on my Home computer is working as expected, like charm. Excellent way to easily identify site collection with slow loading home pages. ๐Ÿ™‚

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Site Footer

%d bloggers like this: