Get started with the SharePoint Online Management Shell To get started using PowerShell to manage SharePoint Online, you need to install the SharePoint Online Management Shell and connect to SharePoint Online. Install the SharePoint Online Management Shell by downloading and running the SharePoint Online Management Shell or
installing the module from the PowerShell Gallery. Once installed, the module is available for use, and you do not need to install it again until you need features introduced in a later version. For example, you may need to install a new version for TLS 1.2 negotiation after October 2018. First you can check if you have already installed the SharePoint
Online Management Shell by running the following command in administrative mode in PowerShell: If your operating system is using Windows PowerShell 5, you can also install the SharePoint Online Management Shell by running the following command in administrative mode: Install-Module -Name Microsoft.Online.SharePoint.PowerShell If you don't have administrative privileges on the system, you can install the SharePoint Online Management Shell only for the current user by running the following command: Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser To ensure you have all available cmdlets, you should always make sure the module is up to date. You can update the SharePoint Online Management Shell by running the following command in administrative mode: Update-Module -Name Microsoft.Online.SharePoint.PowerShell To open the SharePoint Online Management Shell command prompt, from the Start screen, type sharepoint, and then click SharePoint Online Management Shell.
To connect with a user name and password
To assign a user the SharePoint admin role, see Assign admin roles or Assign admin roles to Microsoft 365 user accounts with PowerShell.
Connect-SPOService -Credential $creds -Url https://tenant-admin.sharepoint.com -ModernAuth $true -AuthenticationUrl https://login.microsoftonline.com/organizations To connect with multifactor authentication (MFA)
You are now ready to use SharePoint Online commands.
SharePoint ではサイトコレクションを一時的に読み取り専用やアクセスできない状態に設定することができます。これは、サイトコレクションのメンテナンス時や、緊急時にサイトコレクションへのアクセスを簡易的に制限したいときに有効です。 設定方法<事前準備> ① SharePoint Online 管理シェルを起動し、下記コマンドレットにて SharePoint に接続します。
※URL には SharePoint 管理センターの URL をご指定下さい。 ② 下記コマンドレットにてサイトコレクションの状態を変更します。
※ State には下記の指定が可能です。
ReadOnly に設定NoAccess に設定 |