> For the complete documentation index, see [llms.txt](https://docs.realmjoin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmjoin.com/ja/zi-dong-hua/runbooks/runbook-references/org/devices/delete-stale-devices_scheduled.md).

# 古いデバイスの削除（定期実行）

### 説明

指定した日数の間アクティブでなかった Intune 管理デバイスを識別します。既定では、runbook はレポートのみモード（シミュレーション）で実行され、削除されるデバイスの一覧を表示します。削除が有効な場合、条件に一致するデバイスは Intune から削除され、その結果はレポートに含まれます。CSV および/または Excel (xlsx) の添付ファイル付きのメール レポートを任意で送信でき、レポート ファイルを Azure Storage Account にアップロードして、期間限定のダウンロード リンクを返すこともできます。

### 場所

組織 → デバイス → 古いデバイスの削除 (スケジュール済み)

**Runbook の完全名**

rjgit-org\_devices\_delete-stale-devices\_scheduled

### 権限

#### アプリケーション権限

* **種類**: Microsoft Graph
  * DeviceManagementManagedDevices.ReadWrite.All
  * Directory.Read.All
  * Device.Read.All
  * Mail.Send

### パラメーター

#### 日数

期限切れと見なす、非アクティブな日数。

| プロパティ | 値     |
| ----- | ----- |
| 必須    | false |
| 既定値   | 30    |
| 種類    | Int32 |

#### Windows

結果に Windows デバイスを含めます。

| プロパティ | 値       |
| ----- | ------- |
| 必須    | false   |
| 既定値   | True    |
| 種類    | Boolean |

#### macOS

結果に macOS デバイスを含めます。

| プロパティ | 値       |
| ----- | ------- |
| 必須    | false   |
| 既定値   | True    |
| 種類    | Boolean |

#### iOS

結果に iOS デバイスを含めます。

| プロパティ | 値       |
| ----- | ------- |
| 必須    | false   |
| 既定値   | True    |
| 種類    | Boolean |

#### Android

結果に Android デバイスを含めます。

| プロパティ | 値       |
| ----- | ------- |
| 必須    | false   |
| 既定値   | True    |
| 種類    | Boolean |

#### DeleteDevices

true に設定すると、一致する古いデバイスは Intune から削除されます。false（既定）の場合、runbook は削除されるデバイスのみを報告します（シミュレーション）。

| プロパティ | 値       |
| ----- | ------- |
| 必須    | false   |
| 既定値   | False   |
| 種類    | Boolean |

#### EmailFrom

送信者のメールアドレス。これは runbook のカスタマイズで設定する必要があります

| プロパティ | 値     |
| ----- | ----- |
| 必須    | false |
| 既定値   |       |
| 種類    | 文字列   |

#### ReportFileFormat

生成して配信するレポート ファイルの形式を制御します: "CSV only"、"CSV & XLSX"（既定）または "XLSX only"。

| プロパティ | 値          |
| ----- | ---------- |
| 必須    | false      |
| 既定値   | CSV & XLSX |
| 種類    | 文字列        |

#### CreateDownloadLink

有効にすると、レポート ファイルは Azure Storage Account にアップロードされ、時間制限付きのダウンロード リンクが返されます。既定では無効です。

| プロパティ | 値       |
| ----- | ------- |
| 必須    | false   |
| 既定値   | False   |
| 種類    | Boolean |

#### ContainerName

アップロードに使用するストレージ コンテナー名です。Runbook ごとに構成します（グローバルな RJReport 設定ではありません）。

| プロパティ | 値                    |
| ----- | -------------------- |
| 必須    | false                |
| 既定値   | delete-stale-devices |
| 種類    | 文字列                  |

#### ResourceGroupName

ストレージ アカウントを含むリソース グループです。RJReport の Tenant 設定から取得されます。

| プロパティ | 値     |
| ----- | ----- |
| 必須    | false |
| 既定値   |       |
| 種類    | 文字列   |

#### StorageAccountName

アップロードに使用するストレージ アカウント名です。RJReport の Tenant 設定から取得されます。

| プロパティ | 値     |
| ----- | ----- |
| 必須    | false |
| 既定値   |       |
| 種類    | 文字列   |

#### LinkExpiryDays

生成されたダウンロード リンクの有効期限までの日数です。RJReport の Tenant 設定から取得されます。

| プロパティ | 値     |
| ----- | ----- |
| 必須    | false |
| 既定値   | 6     |
| 種類    | Int32 |

#### UseUserScope

プライマリ ユーザーのグループ メンバーシップに基づいてデバイスを含める、または除外するためのユーザースコープ フィルタリングを有効にします。

| プロパティ | 値       |
| ----- | ------- |
| 必須    | false   |
| 既定値   | False   |
| 種類    | Boolean |

#### IncludeUserGroup

プライマリ ユーザーがこのグループのメンバーであるデバイスのみを含めます。UseUserScope を有効にする必要があります。

| プロパティ | 値     |
| ----- | ----- |
| 必須    | false |
| 既定値   |       |
| 種類    | 文字列   |

#### ExcludeUserGroup

プライマリ ユーザーがこのグループのメンバーであるデバイスを除外します。UseUserScope を有効にする必要があります。

| プロパティ | 値     |
| ----- | ----- |
| 必須    | false |
| 既定値   |       |
| 種類    | 文字列   |

#### EmailTo

指定すると、提供されたアドレス宛てにレポート付きのメールが送信されます。単一のアドレスでも、カンマ区切りの複数アドレスでも指定できます（文字列）。プライバシー上の理由から、関数は受信者ごとに個別のメールを送信します。

| プロパティ | 値     |
| ----- | ----- |
| 必須    | false |
| 既定値   |       |
| 種類    | 文字列   |

[Runbook Reference の概要に戻る](/ja/zi-dong-hua/runbooks/runbook-references.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.realmjoin.com/ja/zi-dong-hua/runbooks/runbook-references/org/devices/delete-stale-devices_scheduled.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
