Windows 11 PC のキッティング(初期セットアップ)から開発環境の構築までを自動化する PowerShell スクリプト集です。
recipe.yaml にやりたいことを書き、Start-Admin.bat を管理者として実行するだけで、手作業で時間のかかるセットアップを大きく減らし、誰がやっても同じ環境をすばやく作れます。recipe.yaml は、ブラウザーで開く レシピ作成アプリ を使えば、チェックを付けるだけで作れます。
- Windows Update の全自動化: 更新がなくなるまで、確認・インストール・再起動を無人で繰り返します。失敗し続ける更新があっても、上限の周回数で止まります。
- Windows の設定変更: エクスプローラーで拡張子を表示するなどの設定を
recipe.yamlに書くだけで、スクリプトを編集せずに変えられます。 - アプリの一括インストールと削除:
wingetで、recipe.yamlに書いたアプリをまとめてインストールし、不要なプリインストールアプリを削除します。最後に、インストール済みのアプリをすべて更新します。 - 再起動を挟んだ 2 フェーズ実行: アプリのインストール(フェーズ 1)と、PATH 環境変数を使う開発ツールの導入(フェーズ 2)の間に再起動を挟みます。インストールしたばかりのコマンドが見つからない、という失敗を防ぎます。
- 開発環境の自動構築: VS Code 拡張機能、
npm、pipなどのパッケージマネージャーを通じて、開発用のパッケージをまとめてインストールします。 - 失敗を見逃さない結果表示: 失敗した項目は最後に一覧で表示し、ログファイルにも残します。
- レシピ作成アプリ: YAML を手で書かなくても、ブラウザーでチェックを付けるだけで
recipe.yamlを作れます。
- Windows 11
- PowerShell 5.1 または PowerShell 7
Start-Admin.batは、PowerShell 7(pwsh.exe)が入っていれば 7 で、なければ 5.1 でスクリプトを動かします。5.1 は非推奨になったため、7 を優先しています。- 5.1 で始めた場合も、再起動のときに 7 が入っていれば、再起動のあとは 7 で続けます(例:AutoSetup のフェーズ 1 で 7 を入れると、フェーズ 2 は 7 で動きます)。
- 管理者権限
- PC を使うアカウントでサインインし、そのまま「管理者として実行」してください。
- 別の管理者アカウントのパスワードを入れて実行すると、設定の一部がそのアカウントに入り、フェーズ 2 も自動で始まりません。
- インターネット接続
- OS のクリーンインストール: Windows 11 をクリーンインストールします。
- リポジトリの配置: このリポジトリをダウンロードし、フォルダーを PC の好きな場所(例:
C:\Users)に置きます。USB メモリや外付けストレージから実行しても、基本的には問題ありません(実行場所ごとの注意点 を参照)。 recipe.yamlの準備: 次のどちらかの方法で、やりたいことを決めます。- レシピ作成アプリ でチェックを付けて保存し、リポジトリ直下の
recipe.yamlと置き換えます。 recipe.yamlをテキストエディターで開き、不要な項目の行頭に#を付けてコメントアウトします。
- レシピ作成アプリ でチェックを付けて保存し、リポジトリ直下の
- スクリプトの実行:
Start-Admin.batを 右クリック し、「管理者として実行」を選びます。- メニューから
1. AutoWindowsUpdateを選び、OS を最新の状態にします(強く推奨)。再起動のたびに、サインインすると続きが自動で始まります。 - 終わったら、もう一度
Start-Admin.batを管理者として実行します。 - メニューから
2. AutoSetupを選び、アプリのインストールと環境構築を始めます。フェーズ 1 のあと自動で再起動し、サインインするとフェーズ 2 が始まります。
- 最終確認:
- 画面の結果まとめに、失敗した項目がないか確認します。失敗があれば、ログファイル で原因を確認します。
- PC を一度、手動で再起動します。
- Windows Update の画面やデバイスマネージャーを開き、更新漏れや不明なデバイスがないか確認します。
| ファイル名 | 役割 |
|---|---|
Start-Admin.bat |
入口となるファイル。 管理者権限を確認し、実行するスクリプトをメニューから選ばせます。 |
AutoWindowsUpdate.ps1 |
Windows Update を全自動で実行します。更新がなくなるまで、確認・インストール・再起動を繰り返します。失敗し続ける更新で止まらなくなるのを防ぐため、10 周で中断します。同じ更新が 2 周続けてインストールに失敗した場合も、その時点で中断します。 |
AutoSetup.ps1 |
recipe.yaml に従って、Windows の設定変更、アプリのインストールと削除、開発環境の構築を、再起動を挟んだ 2 フェーズで実行します。 |
recipe.yaml |
カスタマイズの中心。 インストールするアプリ、Windows の設定、開発パッケージなどを、コメント付きで定義します。 |
template-recipes/ |
recipe.yaml のテンプレート集です。目的別の構成例をフォルダーごとに置いています。 |
APP_RecipeBuilder/recipe-builder.html |
レシピ作成アプリ。 ブラウザーで開き、チェックを付けて recipe.yaml を作れます。ネット接続は不要です。 |
APP_RecipeBuilder/Update-RecipeBuilder.ps1 |
recipe.yaml と template-recipes/ の中身を、レシピ作成アプリに埋め込み直します。 |
APP_RecipeBuilder/images/ |
レシピ作成アプリの「画面を見る」で表示する、Windows の設定画面の画像です。 |
キッティング手順.pdf |
キッティング全体の手順書です。図と画面写真で、再インストールから最終確認までを説明します。 |
AutoSetup未対応の設定手順チートシート/ |
スクリプトで自動化していない設定の手順書です(例: Hyper-V、WSL2 のセットアップ)。 |
.github/workflows/lint.yml |
GitHub Actions の自動チェックです。スクリプトは実行せず、PowerShell 5.1 / 7 での構文チェック、PSScriptAnalyzer による書き方チェック、recipe.yaml の書式チェック、レシピ作成アプリの埋め込みが最新かのチェック、文字コードと改行のチェックを行います。 |
.github/scripts/Test-Recipe.ps1 |
recipe.yaml と template-recipes/ の書式チェックです。書き間違えたキーや、必須キーの抜けを見つけます。手元でも、powershell-yaml を入れた PowerShell で実行できます。 |
.github/scripts/Test-Encoding.ps1 |
文字コードと改行のチェックです。.ps1 は BOM 付き UTF-8 と CRLF、.bat は Shift-JIS と CRLF、.sh は BOM なし UTF-8 と LF になっているかなどを確かめます。手元でも実行できます。 |
セットアップの内容は、recipe.yaml を編集して自由に変えられます。不要な項目は、行頭に # を付けてコメントアウトしてください。
YAML を手で書かずに recipe.yaml を作りたい場合は、APP_RecipeBuilder/recipe-builder.html をダブルクリックして、ブラウザーで開きます。
- 「Windows 設定」「アプリ」「削除するアプリ」「開発パッケージ」のタブで、入れたい項目にチェックを付けます。右側に、できあがる
recipe.yamlがその場で表示されます。 - 「出発点」でテンプレートを選ぶと、その場でテンプレートの内容どおりにチェックが付きます。チェックを変えた後に、選んでいるテンプレートの状態へ戻したいときは「テンプレートの状態に戻す」を押します。どちらも、通知の「元に戻す」で前の選択に戻せます。「recipe.yaml を読み込む」で、手元の
recipe.yamlを読み込んで続きを編集することもできます。 - 一覧の上には、選んだテンプレート(または読み込んだ
recipe.yaml)に書かれている項目だけが、ファイルと同じ順番・見出しで並びます。何も変えずに保存すれば、元のファイルと同じ項目・同じ順番のrecipe.yamlになります。ほかのテンプレートにしかない項目は、その下の「ほかのテンプレートにある項目」に並び、チェックを付けたものだけがrecipe.yamlに入ります。 recipe.yamlで#を付けてコメントアウトした項目は、チェックの付いていない項目として表示されます。逆に、チェックを外した項目は、保存するrecipe.yamlにコメントアウトした形で残ります。あとから有効にするときは、その項目の各行の先頭にある#(#と、その後ろの空白1つ)を消します。- 「すべて選択」「選択をすべて外す」で、すべてのタブのチェックをまとめて付けたり外したりできます。各タブの「表示中をすべて選ぶ」「すべて外す」は、そのタブの中だけが対象です。
- 一覧にない項目は、各タブの「一覧にない項目を追加する」から追加できます。
- 「Windows 設定」タブの項目のうち、設定画面に当たる場所があるものは、「画面を見る」で、その設定が表示される Windows の画面を確かめられます。画像は撮影した PC の画面の例なので、お使いの PC とは状態が違う場合があります。アプリを別の場所にコピーするときは、
imagesフォルダーも一緒にコピーしてください。 - 「recipe.yaml を保存」で保存した
recipe.yamlを、AutoSetup.ps1と同じフォルダーに置いて使います。
recipe.yaml や template-recipes/ を変更したときは、次のコマンドでアプリの一覧を更新してください。
.\APP_RecipeBuilder\Update-RecipeBuilder.ps1再起動の前に実行する、基本的なセットアップを定義します。上から順に、次の処理を行います。
windowsSettings: Windows の設定を変えるコマンドを、description(説明)とcommand(実行するコマンド)で定義します。レジストリの変更などに使います。wingetInstall:wingetでインストールするアプリのidと、必要に応じてインストールオプション(options)を書きます。appxRemove: 削除したい Windows 標準アプリの名前を書きます(ワイルドカード*を使えます)。
この 3 つのあと、winget でインストール済みのアプリをすべて更新し、フェーズ 2 を自動で始めるよう設定して再起動します。
再起動の後に実行する、開発者向けパッケージのインストールを定義します。
packageManagers: パッケージマネージャーを、リスト形式で複数定義できます。managerName: ログに表示する名前です(例:'npm'、'pip')。checkCommand: パッケージがインストール済みかを確認するコマンドです。{package}はパッケージ名に置き換わります。終了コードが 0 以外になるか、エラーが出たときは「未インストール」とみなします(Get-Commandなどの PowerShell コマンドもそのまま使えます)。installCommand: パッケージをインストールするコマンドです。{package}が置き換わります。packages: このマネージャーでインストールするパッケージの一覧です。
リポジトリ直下の recipe.yaml では、フェーズ 2 は空(packageManagers: [])になっています。次の例は、template-recipes/step2_VSCode/recipe.yaml の一部です。
設定例(VS Code 拡張機能):
phase2:
packageManagers:
- managerName: 'vscode'
checkCommand: 'if (-not (code --list-extensions | Where-Object { $_ -eq ''{package}'' })) { throw ''未インストール'' }'
installCommand: 'code --install-extension {package}'
packages:
# 拡張パックに入っている拡張でも、使うものは1つずつ書く。パックの中身は作者の都合で変わることがあるため。
# [表示]
- description: '画面の日本語化'
name: ms-ceintl.vscode-language-pack-ja
- description: 'インデントの深さ別の色分け'
name: oderwat.indent-rainbow
- description: '全角スペースの強調表示'
name: mosapride.zenkaku
- description: 'コメントの種類別の色分け(TODO・注意など)'
name: aaron-bond.better-comments
- description: 'エラー・警告を行の横に表示'
name: usernamehw.errorlens
# [編集の補助]
- description: 'EditorConfig(インデントや改行の書式をファイルでそろえる)'
name: EditorConfig.EditorConfig
- description: 'ファイル パスの入力補完'
name: christian-kohler.path-intellisense
- description: 'TODO コメントの一覧表示'
name: gruntfuggly.todo-treetemplate-recipes/ には、目的別の recipe.yaml のサンプルがあります。環境構築のたたき台がほしいときは、近い構成のテンプレートをリポジトリ直下にコピーし、自分に合わせて調整してから AutoSetup.ps1 を実行してください。レシピ作成アプリの「出発点」からも選べます。
step1_only_basic/: フェーズ 1 だけの最小構成です(基本の設定とアプリ)。step1_only_dev/: フェーズ 1 が中心で、開発用のアプリも入れる構成です。フェーズ 2 では、PSScriptAnalyzer(PowerShell の書き方チェック)だけを入れます。step2_VSCode/・step2_npm/・step2_pip/・step2_Rust/・step2_Go/・step2_Haskell/: フェーズ 2 で、それぞれのツールや言語のパッケージを入れる構成です。step2_all/: 上のフェーズ 2 をすべてまとめた、全部入りの構成です。step2_Haskell/とstep2_all/は、GHC 9.10.3(GHCup のおすすめ版)を既定にします。cabal・stack・HLS は、GHCup のおすすめ版を入れます。step1_only_basic/以外のテンプレートは、フェーズ 2 で PSScriptAnalyzer を PowerShell 7 に入れます。
スクリプトの実行記録は、スクリプトと同じフォルダーに保存されます。
AutoWindowsUpdate.log:AutoWindowsUpdate.ps1の実行記録です。AutoSetup.log:AutoSetup.ps1の実行記録です。フェーズ 1 とフェーズ 2 の記録が、1 つのファイルにまとめて追記されます。AutoSetup-phase1-failures.log: フェーズ 1 で失敗した項目の一覧です。再起動で画面が消えても、フェーズ 2 の最後の結果まとめに一緒に表示するために使います。表示し終わると削除されます。
失敗した項目があると、処理の最後に一覧で表示されます。
- 最も安全です。再起動後もパスが変わりません。
- 基本的には問題ありませんが、再起動やサインインの後も、同じドライブレターでつながっている必要があります。
- 取り外したりドライブレターが変わったりすると、フェーズ 2 や再起動後の続きが始まりません。失敗した場合は、ドライブをつなぎ直して手動で実行し直してください。
- UNC パス上でも実行できますが、共有への書き込み権限と、安定した接続が必要です。
- サインイン時に共有へ自動で再接続されない環境では、タスクスケジューラがスクリプトを見つけられずに失敗します。必要に応じて、ローカルにコピーしてから実行してください。
- 基本的な制約は、ファイルサーバー共有と同じです。
- NAS のスリープや再接続の遅れで、タスクが失敗することがあります。処理が長くかかる場合は、ローカルディスクでの実行を検討してください。
- 英語版の Windows(Hyper-V のクイック作成で用意した開発者用環境など)では、システムロケールが英語のため、日本語が文字化けします。
- 「設定 > 時刻と言語 > 言語と地域 > 管理用の言語の設定 > システム ロケールの変更」で「日本語(日本)」を選び、再起動してください。「ベータ: ワールドワイド言語サポートで Unicode UTF-8 を使用」のチェックは外したままにします。
- くわしい手順は、Hyper-V に Windows 11 をインストールする手順 の「4B‑2:日本語化(GUI)」を参照してください。
- 再起動後の自動実行の登録に失敗した場合、
AutoSetup.ps1は自動で再起動せず、手順を表示して止まります。 - 手動で PC を再起動したあと、管理者の PowerShell で次のコマンドを実行すると、フェーズ 2 を始められます。
& "C:\Users\PowerShell-KittingScripts\AutoSetup.ps1" -setupPhase 2(パスは、リポジトリを置いた場所に読み替えてください。)
- インターネット接続を確認し、管理者の PowerShell で
Install-Module -Name powershell-yaml -RequiredVersion 0.4.12 -Scope AllUsersを手動で実行してください。AutoSetup.ps1は、CI で確かめた版と同じ 0.4.12 だけを使います。
Microsoft の winget configuration は、宣言的に環境を構築できる強力な標準機能です。このプロジェクトは、特定の作業の流れをより深く自動化するために、次の機能を持っています。
-
Windows Update の自動ループ
AutoWindowsUpdate.ps1は、更新がなくなるまで「更新の確認 → インストール → 再起動」を自動で繰り返します。 タスクスケジューラを使って再起動後も処理を続けるので、一度実行すれば、最新の状態になるまで無人で進みます。 -
再起動を必ず挟む 2 フェーズ実行 「システムの変更」と「開発ツールの導入」の間に必ず再起動を挟むことで、PATH 環境変数が反映されていないために、フェーズ 2 で
npmやuvなどのコマンドが見つからない、という問題を防ぎます。 -
メニューから選ぶだけの操作
Start-Admin.batのメニューから「1. AutoWindowsUpdate を実行する」「2. AutoSetup を実行する」の順に選ぶだけなので、PowerShell に慣れていない人でも迷わずに進められます。 -
パッケージマネージャーを自由に追加できる
npmやpipなどのインストール方法は、recipe.yamlのcheckCommandとinstallCommandで定義します。スクリプトを編集せずに、cargo(Rust)のような新しいパッケージマネージャーを追加できます。
このプロジェクトは MIT License の下で公開されています。
A collection of PowerShell scripts that automate everything from Windows 11 PC kitting (initial setup) to building a development environment.
Write what you want in recipe.yaml and run Start-Admin.bat as administrator. This greatly reduces time-consuming manual setup and lets anyone build the same environment quickly. With the browser-based recipe builder app, you can create recipe.yaml just by ticking checkboxes.
- Fully automated Windows Update: Checks, installs, and reboots unattended until no updates remain. Even if an update keeps failing, it stops at the round limit.
- Windows settings changes: Write settings such as showing file extensions in File Explorer in
recipe.yaml, and change them without editing the scripts. - Batch app installation and removal: Uses
wingetto install the apps listed inrecipe.yamland remove unwanted preinstalled apps. At the end, it updates all installed apps. - Two-phase execution with a reboot in between: Inserts a reboot between app installation (phase 1) and development tools that rely on the PATH environment variable (phase 2). This prevents failures where newly installed commands cannot be found.
- Automated development environment setup: Installs development packages at once through package managers such as VS Code extensions,
npm, andpip. - Results that do not hide failures: Failed items are listed at the end and also recorded in log files.
- Recipe builder app: Create
recipe.yamlby ticking checkboxes in a browser, without writing YAML by hand.
- Windows 11
- PowerShell 5.1 or PowerShell 7
Start-Admin.batruns the scripts with PowerShell 7 (pwsh.exe) if it is installed, and with 5.1 otherwise. PowerShell 7 comes first because 5.1 is now deprecated.- Even if a run starts on 5.1, it continues on 7 after a restart when 7 is installed by then (for example, if AutoSetup installs 7 in phase 1, phase 2 runs on 7).
- Administrator privileges
- Sign in with the account that will use the PC, and choose "Run as administrator" from that account.
- If you enter a different administrator account's password instead, some settings go to that account, and phase 2 does not start automatically.
- Internet connection
- Clean OS installation: Install Windows 11 fresh.
- Place the repository: Download this repository and put the folder anywhere on the PC (e.g.,
C:\Users). Running it from a USB drive or other external storage is generally fine (see Location-Specific Considerations). - Prepare
recipe.yaml: Decide what to do in one of these ways.- Tick items in the recipe builder app, save, and replace
recipe.yamlin the repository root. - Open
recipe.yamlin a text editor and comment out unnecessary entries with#at the start of the line.
- Tick items in the recipe builder app, save, and replace
- Run the scripts:
- Right-click
Start-Admin.batand choose Run as administrator. - From the menu, select
1. AutoWindowsUpdateto bring the OS up to date (strongly recommended). After each reboot, the next round starts automatically when you sign in. - When it finishes, run
Start-Admin.batas administrator again. - Select
2. AutoSetupfrom the menu to start app installation and environment setup. After phase 1, the PC reboots automatically, and phase 2 starts when you sign in.
- Right-click
- Final checks:
- Check the result summary on the screen for failed items. If there are any, check the cause in the log files.
- Restart the PC manually once.
- Open Windows Update and Device Manager to confirm there are no missing updates or unknown devices.
| File Name | Role |
|---|---|
Start-Admin.bat |
Entry point. Confirms administrator privileges and lets you choose a script from a menu. |
AutoWindowsUpdate.ps1 |
Runs Windows Update end to end. Repeats checking, installing, and rebooting until no updates remain. Stops after 10 rounds so that an update that keeps failing cannot cause an endless loop. Also stops as soon as the same update fails to install in two consecutive rounds. |
AutoSetup.ps1 |
Following recipe.yaml, changes Windows settings, installs and removes apps, and sets up the development environment in two phases with a reboot in between. |
recipe.yaml |
Customization hub. Defines apps to install, Windows settings, development packages, and more, with comments. |
template-recipes/ |
Template collection for recipe.yaml. Holds purpose-specific examples, one folder each. |
APP_RecipeBuilder/recipe-builder.html |
Recipe builder app. Open it in a browser and create recipe.yaml by ticking checkboxes. No internet connection is needed. |
APP_RecipeBuilder/Update-RecipeBuilder.ps1 |
Re-embeds the contents of recipe.yaml and template-recipes/ into the recipe builder app. |
APP_RecipeBuilder/images/ |
Screenshots of Windows settings screens, shown by "画面を見る" (show the screen) in the recipe builder app. |
キッティング手順.pdf |
Illustrated guide (in Japanese) to the whole kitting workflow, from reinstalling Windows to the final checks, with diagrams and screenshots. |
AutoSetup未対応の設定手順チートシート/ |
Guides for settings that the scripts do not automate (e.g., Hyper-V, WSL2 setup). |
.github/workflows/lint.yml |
GitHub Actions checks. Without running the scripts, it checks syntax on PowerShell 5.1 / 7, coding style with PSScriptAnalyzer, the format of recipe.yaml, whether the templates embedded in the recipe builder app are up to date, and file encodings and line endings. |
.github/scripts/Test-Recipe.ps1 |
Format check for recipe.yaml and template-recipes/. Finds misspelled keys and missing required keys. You can also run it locally in PowerShell with powershell-yaml installed. |
.github/scripts/Test-Encoding.ps1 |
Encoding and line-ending check. Confirms, for example, that .ps1 files are UTF-8 with BOM and CRLF, .bat files are Shift-JIS and CRLF, and .sh files are UTF-8 without BOM and LF. You can also run it locally. |
You can freely change what the setup does by editing recipe.yaml. Comment out unnecessary entries with # at the start of the line.
If you want to create recipe.yaml without writing YAML by hand, double-click APP_RecipeBuilder/recipe-builder.html to open it in a browser.
- Tick the items you want on the "Windows 設定" (Windows settings), "アプリ" (apps), "削除するアプリ" (apps to remove), and "開発パッケージ" (development packages) tabs. The resulting
recipe.yamlappears on the right as you go. - Choose a template in "出発点" (starting point) to tick items as the template defines right away. To go back to the selected template after changing ticks, press "テンプレートの状態に戻す" (reset to the template). Either way, "元に戻す" (undo) in the notification restores the previous selection. You can also load an existing
recipe.yamlwith "recipe.yaml を読み込む" (load recipe.yaml) and continue editing it. - The top of each list shows only the items written in the selected template (or the loaded
recipe.yaml), in the same order and under the same headings as the file. If you save without changes, you get arecipe.yamlwith the same items in the same order as the original. Items that exist only in other templates are listed below under "ほかのテンプレートにある項目" (items in other templates), and only the ones you tick go intorecipe.yaml. - Entries commented out with
#inrecipe.yamlappear as unticked items. In the other direction, unticked items are kept in the savedrecipe.yamlas commented-out entries. To enable one later, remove the leading#(the#and the one space after it) from each of its lines. - "すべて選択" (select all) and "選択をすべて外す" (clear all) tick or clear items on all tabs at once. "表示中をすべて選ぶ" (select all shown) and "すべて外す" (clear all) on each tab affect only that tab.
- Items that are not in the list can be added from "一覧にない項目を追加する" (add an item that is not in the list) on each tab.
- For items on the "Windows 設定" tab that have a matching place in the Windows settings screens, "画面を見る" (show the screen) shows the Windows screen where that setting appears. The images are examples taken on one PC, so your PC may show a different state. When you copy the app somewhere else, copy the
imagesfolder with it. - Save
recipe.yamlwith "recipe.yaml を保存" (save recipe.yaml) and place it in the same folder asAutoSetup.ps1.
When you change recipe.yaml or template-recipes/, run the following command to update the lists in the app.
.\APP_RecipeBuilder\Update-RecipeBuilder.ps1Defines the basic setup that runs before the reboot. The following run in order from the top.
windowsSettings: Define commands that change Windows settings withdescriptionandcommand(the command to run). Used for registry changes and similar tweaks.wingetInstall: List theidof each app to install withwinget, plus install options (options) if needed.appxRemove: List the names of built-in Windows apps to remove (the*wildcard is supported).
After these three, it updates all installed apps with winget, sets phase 2 to start automatically, and reboots.
Defines the developer package installation that runs after the reboot.
packageManagers: Define one or more package managers as a list.managerName: Name shown in logs (e.g.,'npm','pip').checkCommand: Command that checks whether a package is installed.{package}is replaced with the package name. A non-zero exit code or an error means "not installed" (PowerShell cmdlets such asGet-Commandwork as-is).installCommand: Command that installs a package.{package}is replaced as well.packages: List of packages to install with that manager.
In the recipe.yaml at the repository root, phase 2 is empty (packageManagers: []). The following example is an excerpt from template-recipes/step2_VSCode/recipe.yaml.
Example (VS Code extensions):
phase2:
packageManagers:
- managerName: 'vscode'
checkCommand: 'if (-not (code --list-extensions | Where-Object { $_ -eq ''{package}'' })) { throw ''未インストール'' }'
installCommand: 'code --install-extension {package}'
packages:
# List each extension you use, even if an extension pack includes it, because a pack's contents can change.
# [Display]
- description: 'Japanese UI localization'
name: ms-ceintl.vscode-language-pack-ja
- description: 'Indentation colored by depth'
name: oderwat.indent-rainbow
- description: 'Highlighted full-width spaces'
name: mosapride.zenkaku
- description: 'Comments colored by type (TODO, warnings, and so on)'
name: aaron-bond.better-comments
- description: 'Errors and warnings shown next to the line'
name: usernamehw.errorlens
# [Editing aids]
- description: 'EditorConfig (keeps indentation and line endings consistent through a file)'
name: EditorConfig.EditorConfig
- description: 'File path completion'
name: christian-kohler.path-intellisense
- description: 'List of TODO comments'
name: gruntfuggly.todo-treetemplate-recipes/ contains sample recipe.yaml files for different purposes. If you want a starting point, copy the closest template to the repository root, adjust it to your needs, and then run AutoSetup.ps1. You can also choose them from "出発点" (starting point) in the recipe builder app.
step1_only_basic/: Minimal setup with phase 1 only (basic settings and apps).step1_only_dev/: Mainly phase 1, also installing development apps. Phase 2 installs only PSScriptAnalyzer (a PowerShell style checker).step2_VSCode/,step2_npm/,step2_pip/,step2_Rust/,step2_Go/,step2_Haskell/: Install packages for each tool or language in phase 2.step2_all/: All-in-one setup that combines all of the phase 2 sets above.step2_Haskell/andstep2_all/make GHC 9.10.3 (the GHCup recommended version) the default. They install the GHCup recommended versions of cabal, stack, and HLS.- All templates except
step1_only_basic/install PSScriptAnalyzer into PowerShell 7 in phase 2.
Execution logs are saved in the same folder as the scripts.
AutoWindowsUpdate.log: Log ofAutoWindowsUpdate.ps1.AutoSetup.log: Log ofAutoSetup.ps1. Phase 1 and phase 2 are appended to the same file.AutoSetup-phase1-failures.log: List of items that failed in phase 1. It is used to show them in the result summary at the end of phase 2, even though the reboot clears the screen. It is deleted after being shown.
If any items fail, they are listed at the end of the run.
- Safest option. Paths do not change after reboots.
- Generally fine, but the drive must stay connected under the same drive letter after reboots and sign-ins.
- If the drive is removed or the letter changes, phase 2 or the next round after a reboot cannot start. If that happens, reconnect the drive and rerun manually.
- Works over UNC paths, but requires write permission to the share and a stable connection.
- In environments where the share does not reconnect automatically at sign-in, Task Scheduler cannot find the scripts and fails. Copy them locally first if needed.
- The same basic constraints as file shares apply.
- NAS sleep or reconnection delays may cause tasks to fail. For long runs, consider running from a local disk.
- On English Windows (such as the developer environment created with Hyper-V Quick Create), the system locale is English, so Japanese text is garbled.
- Go to "Settings > Time & language > Language & region > Administrative language settings > Change system locale", select "Japanese (Japan)", and restart. Leave "Beta: Use Unicode UTF-8 for worldwide language support" unchecked.
- For detailed steps, see "4B‑2:日本語化(GUI)" (Japanese localization) in Hyper-V に Windows 11 をインストールする手順 (Japanese only).
- If registering the automatic run after the reboot fails,
AutoSetup.ps1does not reboot automatically; it shows the steps and stops. - Restart the PC manually, then run the following command in an administrator PowerShell to start phase 2.
& "C:\Users\PowerShell-KittingScripts\AutoSetup.ps1" -setupPhase 2(Replace the path with where you placed the repository.)
- Check your internet connection and run
Install-Module -Name powershell-yaml -RequiredVersion 0.4.12 -Scope AllUsersmanually in PowerShell as an administrator.AutoSetup.ps1uses only version 0.4.12, the same version checked in CI.
Microsoft's winget configuration is a powerful built-in feature for declarative environment setup. This project has the following features to automate a specific workflow more deeply.
-
Automated Windows Update loop
AutoWindowsUpdate.ps1automatically repeats "check for updates → install → reboot" until no updates remain. It uses Task Scheduler to continue after each reboot, so once started, it runs unattended until the system is up to date. -
Two-phase execution that always reboots in between By always rebooting between "system changes" and "developer tool installation", it prevents commands such as
npmoruvfrom being unavailable in phase 2 because the PATH environment variable has not been refreshed. -
Simple menu-driven operation You just choose "1. AutoWindowsUpdate を実行する" (run AutoWindowsUpdate) and then "2. AutoSetup を実行する" (run AutoSetup) from the
Start-Admin.batmenu, so even people unfamiliar with PowerShell can proceed without getting lost. -
Freely add package managers How to install packages for
npm,pip, and others is defined withcheckCommandandinstallCommandinrecipe.yaml. You can add new package managers such ascargo(Rust) without editing the scripts.
This project is released under the MIT License.

