How to Run CSOM-EnumerateSiteUrls.ps1 Using CSOM and Search to Gather List of Personal Sites in SharePoint Online

This post provides step-by-step instructions to help you understand how to successfully run the example PowerShell script available in the Microsoft download center "CSOM-EnumerateSiteUrls.ps1", which uses the SharePoint client side object model (CSOM) and Search to gather a list of personal sites in Office 365 SharePoint Online.

Enumerate Site URLs in SharePoint Online

  • File Name: CSOM-EnumerateSiteUrls.ps1
  • Version: Oct2014
  • Date Published: 10/3/2014
  • File Size: 11 KB

Prior to running the example PowerShell script, you must install client components SDK in order to run SharePoint 2013 CSOM…

SharePoint Server 2013 Client Components SDK


How To Run CSOM-EnumerateSiteUrls.ps1

1. Launch a Windows Powershell window and Run As Administrator. 

Note: Do NOT launch SharePoint Online Management Shell window!  Do NOT execute any Connect-SPOService cmdlet!  Otherwise, script will fail with the error... 'New-Object : Cannot find an overload for "KeywordQuery" and the argument count: "1"'

2. Change directory to location of the PowerShell script.

3. Execute the PowerShell script.


4. Script prompts to supply value for MySiteHostURL parameter value. Supply value similar to following, where "<tenant>" is your Office 365 tenant (example, "contoso").


5. Script prompts to supply value for Adminlogin. Specify a Global Administrator account for your tenant.


6. Script prompts to "Please enter your password" for <Adminlogin>.  Type password for the Global Admin account specified as Adminlogin parameter. Then press Enter.


I have test run the script successfully myself using installed SharePoint Client Components at version 15.0.4641.1002 (as verified in Windows Programs and Features).

Installed location of DLLs was...
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\




Comments (1)
  1. Sam Larson says:

    Hey Marj ,

    Figured i'd chime in here since I helped right this one awhile back.

    It's good to note that we have an easier way to grab ODB site URLs now through the CSOM listed here.

    This uses the User profile service instead of search and is much more reliable.

Comments are closed.

Skip to main content