Sharepoint and powershell

How can I point powershell to a sharepoint farm. I am searching for PII data and I have the script written to look for this type of data however, not exactly sure how I can point my script to the sharepoint farm. Any help is appreciated.


You need to either be directly on the SharePoint server to leverage the SharePoint cmdlets or use PowerShell Remoteing (implicit or Explicit) to proxy the cmdlets to your workstation.

SharePoint 2010 with Windows PowerShell Remoteing Step by Step

If this is SharePoint online you have to down load and install the SPO tools to get the SPO cmdlets as well as the MSOL tool to be able to sign-in and use them.

Introduction to the SharePoint Management Shell

On-prem or cloud see also:

Index of Windows PowerShell cmdlets for SharePoint 2013’

Windows PowerShell for SharePoint 2013 reference

Use Windows PowerShell to administer SharePoint 2013

Use PowerShell Cmdlets to Manage SharePoint Document Libraries
Use PowerShell Cmdlets to Manage SharePoint Document Libraries - Scripting Blog

Use Windows PowerShell cmdlets to manage sites in SharePoint 2013

Use Windows PowerShell cmdlets to administer and configure search in SharePoint 2013’

PowerShell Script to Configure Search in SharePoint Server 2010

Why do this from scratch, when there are several pre-built scripts / cmdlets / modules that do this already?

Security Watch Where Is My PII?

Using Powershell to report on files containing PII (Personally Identifiable Info

Using Powershell to report on files containing PII

Search for sensitive content in SharePoint and OneDrive documents

Create a DLP policy to protect documents with FCI or other properties
In Office 365, you can use a data loss prevention (DLP) policy to identify, monitor, and protect sensitive information. Many organizations already have a process to identify and classify sensitive information by using the classification properties in Windows Server File Classification Infrastructure (FCI), the document properties in SharePoint, or the document properties applied by a third-party system.

You could also just use the Windows File Classification Infrastructure to search through and tag/classify files based on content both on-prem and in O365, though in O365 it’s be rebranded to be called Azure Information Protection (AIP). Well, that and the many 3rdP solutions you can buy, that does this out of the box.

Unless this is a learning exercise for you, from a class or self imposed?