# Windowsタスクによる自動化

Windowsで特定のKeeperコマンダー CLIコマンドを定期的に実行するスケジュールタスクを設定するには、タスクスケジューラを使用します。

以下の例では、ボルト内のパスワードを毎日再生成するタスクを設定します。

{% stepper %}
{% step %}
**インストール**

[WindowsでKeeperコマンダーをインストール](https://docs.keeper.io/jp/keeperpam/commander-cli/commander-installation-setup/installation-on-windows)します。
{% endstep %}

{% step %}
**ログイン**

以下のようにアプリケーションを起動してコマンダーにログインします。

<pre><code><strong>server US
</strong>login email@company.com
</code></pre>

{% endstep %}

{% step %}
**永続ログインを有効にする**

ログイン後、タスクスケジューラからコマンドを実行できるように永続ログインを設定します。

以下の例では「ログイン状態を維持」を30日間に設定します。

```
this-device register
this-device persistent-login on
this-device ip-auto-approve on
this-device timeout 30d
quit
```

シェルセッションを終了する場合は、`logout` ではなく `quit` を入力します。`logout` を実行するとセッションが失効し、自動化が動作しなくなります。

永続ログインが正しく機能していることを確認するには、Keeperコマンダーを再度実行してください。自動的にシェルへログインされます。
{% endstep %}

{% step %}
**レコードを作成する**

コマンドラインから、ランダムなパスワードを使用してレコードを作成します。

```
record-add -t "Test Record" password=$GEN --record-type=login
```

ウェブボルトや他のKeeperボルトを開いている場合は、レコードが表示されるのが確認できます。
{% endstep %}

{% step %}
**タスクスケジューラを開く**

* `Win + R` を押すと実行ダイアログが開きます。
* `taskschd.msc` と入力し、Enterキーを押します。タスクスケジューラが開きます。
  {% endstep %}

{% step %}
**新しい基本タスクを作成する**

* タスクスケジューラで、右側の **\[基本タスクの作成]** をクリックします。
* 「Daily Keeper Commander Task」など、タスクの名前と説明を入力します。
* **\[次へ]** をクリックします。
  {% endstep %}

{% step %}
**トリガーを設定する**

* 「Daily」(毎日) を選択し、**\[次へ]** をクリックします。
* タスクを実行する開始日時を設定します。タスクを毎日繰り返すには、繰り返しが「1 day」に設定されていることを確認します。
* **\[次へ]** をクリックします。
  {% endstep %}

{% step %}
**アクションを設定する**

* 「プログラムの開始」オプションを選択し、**\[次へ]** をクリックします。
* 「Program/script」フィールドに、以下のようにKeeperコマンダー実行可能ファイルへのパスを入力します。

```
"C:\Program Files (x86)\Keeper Commander\keeper-commander.exe"
```

* 「Add arguments (optional)」(引数の追加) フィールドに、以下のようにKeeperコマンダーCLIのコマンドを入力します。

```bash
record-update -r "Test Record" password=$GEN
```

{% endstep %}

{% step %}
**タスクを完了する**

* **\[次へ]** をクリックして、タスクの詳細を確認します。
* **\[完了]** をクリックしてタスクを作成します。
* コマンドが機能することを確認するには、タスクを選択して右側の **\[実行]** をクリックします。
  {% endstep %}
  {% endstepper %}

## まとめ <a href="#summary" id="summary"></a>

この例では、パスワードがKeeperボルトからローテーションされ、その変更はログイン中のすべてのボルトクライアントにリアルタイムで反映されます。

別の例として、以下のようなセキュリティ監査レポートを実行することもできます。

```
security-audit-report --output c:\path\to\file
```

エンドユーザー向けボルトや管理コンソールのあらゆる機能や操作は、この方法で自動化できます。利用可能なKeeperコマンダーの[コマンドリファレンス](https://docs.keeper.io/jp/keeperpam/commander-cli/command-reference)をご確認ください。

この仕組みをさらに活用する場合は、CLI引数に直接コマンドを記述するのではなく、**バッチファイル**を作成して複数のコマンドをまとめて実行する方法が適しています。バッチモードコマンドの詳細については、[こちらのページ](https://docs.keeper.io/jp/keeperpam/commander-cli/commander-installation-setup/..#komandclinobainariinsutru)をご参照ください。


---

# Agent Instructions: 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:

```
GET https://docs.keeper.io/jp/keeperpam/commander-cli/commander-installation-setup/configuration/automating-with-windows-task.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
