How To Setup Development Environment For CSOM Based Powershell Development

Since the evolution of PowerShell, Development framework can be used in conjunction with CSOM API of SharePoint. This type of development could be relatively more useful in scenarios where we do not have direct access to SharePoint Server and only client machines are accessible.

In this article, we will explore the steps that can be helpful in setting up the client machines for PowerShell development.

Following are the steps that we can follow to setup the client machines.

Step 1 Download Windows Management Framework 3.0

  • Visit the following URL.
  • Click on "Download".

    SharePoint

  • Select “Windows6.1-KB2506143-x64.msu” file to download.
  • Click "Next".
    SharePoint
  • Save the downloaded file to the local folder.

    SharePoint

Step 2 Install Windows Management Framework 3.0

  • Run the Executable (.exe) File “Windows6.1-KB2506143-x64.msu”.

    SharePoint

Wait till the installer has been completed.

SharePoint
Step 3 Copy SharePoint CSOM DLLs

Add all the SharePoint CSOM DLLs from any SharePoint System to the local folder.

SharePoint
Step 4 Add the DLL references

Add reference to the required SharePoint DLLs to the PowerShell Code.

At the bare minimum, we need to add the reference of the following two DLLs -

  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.Runtime.dll

    SharePoint
Step 5 Perform Configuration Test
  • Write PowerShell code targeting SharePoint On-Premise site.

    SharePoint
  • Run PowerShell Script

    SharePoint

And sure enough we will get the output of the PowerShell Commands.

SharePoint

The successful execution of the script proves that we have done the configuration correctly.

Hope you find it helpful.