0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Microsoft 365】Microsoft 365 グループを PowerShell で作成する

Last updated at Posted at 2021-06-18

準備

Exchange Online PowerShell V2 モジュール をインストールする

以下のコマンドでモジュールをインストール、または更新してください。

if((Get-Module ExchangeOnlineManagement -ListAvailable | measure).Count -eq 0) {
    Install-Module ExchangeOnlineManagement -Force
} else {
    Update-Module ExchangeOnlineManagement
}

グループの新規作成

Exchange Online に接続する

$Credential = Get-Credential
Connect-ExchangeOnline -Credential $Credential

グループを作成する

CSV ファイルのデータを元にグループを作成します。以下のようなデータのファイルを用意します。
※他に追加したいパラメーターがあれば増やしてください。

GroupList.csv
DisplayName Alias AccessType ManagedBy Language
グループ1 Group01 Public admin ja-JP
グループ2 Group02 Public admin ja-JP
グループ3 Group03 Public admin ja-JP

以下のコマンドを実行します。

ipcsv 'GroupList.csv' | % {
    New-UnifiedGroup -DisplayName $_.DisplayName -Alias $_.Alias -AccessType $_.AccessType -ManagedBy $_.ManagedBy -Language $_.Language
}

グループの情報を CSV ファイルに出力する

Get-UnifiedGroup | select Name, DisplayName, Alias, PrimarySmtpAddress, AccessType, ManagedBy, Language | epcsv -NoTypeInformation -Encoding UTF8 -Path 'GroupList.csv'

参考サイト

0
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?