This solution shows how you can build a library of PowerShell commands that act towards SharePoint Online. The commands use CSOM and can work against both SharePoint Online as SharePoint On-Premises.
- Office 365 Multi Tenant (MT)
- Office 365 Dedicated (D)
- SharePoint 2013 on-premises
In order to build the setup project the WiX toolset needs to be installed. You can obtain this from http://wix.codeplex.com. If you use Visual Studio 2015 you will need at least WiX 3.10, which can be downloaded from here: http://wixtoolset.org/releases/
In order to generate the generate the Cmdlet help you need Windows Management Framework v4.0 which you can download from http://www.microsoft.com/en-us/download/details.aspx?id=40855
Solution | Author(s) |
---|---|
OfficeDevPnP.PowerShell | Erwin van Hunen |
THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
A build script will copy the required files to a folder in your users folder, called: C:\Users<YourUserName>\Documents\WindowsPowerShell\Modules\OfficeDevPnP.PowerShell.Commands
This will automatically load the module after starting PowerShell 3.0. To use the library you first need to connect to your tenant:
Connect-SPOnline –Url https://yoursite.sharepoint.com –Credentials (Get-Credential)
In case of an unattended script you might want to add a new entry in your credential manager of windows.
Select Windows Credentials and add a new generic credential:
Now you can use this entry to connect to your tenant as follows:
Connect-SPOnline –Url https://yoursite.sharepoint.com –Credentials yourlabel
Navigate here for an overview of all cmdlets and their parameters: