Thursday, 10 August 2017

Working With SharePoint Online Using Powershell - 1

Hi All,

Today I will define the steps and prerequisites for using Windows Powershell, Powershell ISE to manage available options in SharePoint Online, Office 365 SharePoint.
  1. For running Powershell commands/scripts in Office 365 SharePoint you will have to Install SharePoint Online Management Shell in a Machine where you want to run Powershell scripts. 
    1. It is not required to have any SharePoint Version installed on such machine. 
    2. Simply install SharePoint Online Management Shell and you will be able to run SharePoint online Powershell commands/scripts there for more details click here
    3. You only need to do this once for each computer from which you are running SharePoint Online Powershell commands/scripts.
    4. Download SharePoint Online Management Shell.
    5. Supported Powershell Version - 3.0 or later
    6. Supported Operating Systems - Windows 7 Service Pack 1, Windows 8, Windows 10, Windows Server 2008 Service Pack 2, Windows Server 2008 R2 SP1, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016.
    7. This installation will install Microsoft.Online.SharePoint.Powershell module in your windows modules that will further be used by Powershell.
  2. After installation of SharePoint Online Management Shell is done, user can run SharePoint Online Management Shell but remember to execute it with elevated credentials (administrator). For doing so search for SharePoint Online Management Shell in menu, right click on it and click on Run as Administrator.
  3. Basically SharePoint Online Management Shell is a normal Microsoft Windows Powershell window that imports a module Microsoft.Online.SharePoint.Powershell automatically on startup. So
  4. If you do not want to run SharePoint Online Management Shell, instead you want to use Windows Power Shell or Windows Power Shell ISE you can do so. Just use following command for the first time in Power shell before running any SharePoint Online Powershell Commands.
    • Import-Module Microsoft.Online.SharePoint.Powershell -DisableNameChecking
    1. This command will import SharePoint online Powershell module that is installed by SharePoint Online Management Shell.
    2. DisableNamechecking - parameter is used to suppress the message that warns you when you import a cmdlet or function whose name whose name includes an unapproved verb or a prohibited characters. This is only a warning and the complete module is still imported including the non-conforming commands for details click here.
    3. Make sure that you have started Windows Powershell or Windows Powershell ISE as Administrator otherwise Import may fail.
  5. The user who want to run SharePoint Online Powershell commands or scripts, Must be a Global Administrator in Office 365.

No comments:

Post a Comment