0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M365メッセージセンター(MC)をGraph PowerShellで一括取得・CSV管理する

0
Last updated at Posted at 2026-05-14

Microsoft 365の管理者にとって、メッセージセンター(MC)の通知をどう追いかけるかは悩みどころです。管理センターのUIで1件ずつ確認するのは非効率で、重要なMCを見落とすリスクもあります。

Microsoft Graph PowerShell SDKを使えば、MCの一覧取得・フィルタリング・CSV出力を数行で自動化できます。

必要なもの

  • Microsoft 365テナントの管理者権限(メッセージセンターの閲覧権限)
  • Microsoft Graph PowerShell SDK(PowerShell 7.4以上を推奨)
  • アプリ権限で実行する場合はサービスプリンシパル(ServiceMessage.Read.All)
Install-Module Microsoft.Graph -Scope CurrentUser

基本:MCを一括取得してCSVに出力する

Connect-MgGraph -Scopes "ServiceMessage.Read.All" -NoWelcome

$messages = Get-MgServiceAnnouncementMessage -All

$messages |
    Select-Object Id, Title, StartDateTime, EndDateTime, Severity, @{
        Name = "Services"; Expression = { $_.Services -join ", " }
    } |
    Sort-Object StartDateTime -Descending |
    Export-Csv -Path ".\mc_list.csv" -Encoding UTF8 -NoTypeInformation

Services は配列なので、そのままCSVに出すと System.String[] になります。-join で文字列にしておくのがポイントです。

重要度で絞り込む

$highPriority = $messages | Where-Object { $_.Severity -in @("high", "critical") }
$highPriority | Select-Object Id, Title, StartDateTime | Format-Table -AutoSize

タグで絞り込む

MCには planForChange(変更への備えが必要)や stayInformed(情報提供)などのタグが付いています。

$planForChange = $messages | Where-Object { $_.Tags -contains "planForChange" }
$planForChange | Select-Object Id, Title, StartDateTime | Format-Table -AutoSize

実運用での使い方

私はこのスクリプトをベースに、MC番号・タイトル・影響度判定(対応必須/確認推奨/無視OK)・対応期限をCSVで管理しています。毎月の振り返りでは、このCSVを元に「今月どれに手を打つべきか」を判断しています。

MCは一定期間が過ぎると管理センターから見えなくなるため、CSVで手元に残しておくと「あの変更、いつ告知されてたっけ」を後から追えるのも地味に便利です。

影響度の判断軸や毎月のMCまとめは、ブログで解説しています。
👉 https://rocomoco99.com

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?