jpskill.com
🛠️ 開発・MCP コミュニティ

powershell-5.1-expert

Windows PowerShell 5.1の専門家として、WMIやADSI、COMオブジェクトを活用し、レガシーなWindows環境での自動化を支援するSkill。

📜 元の英語説明(参考)

Expert in legacy Windows PowerShell 5.1. Specializes in WMI, ADSI, COM automation, and maintaining backward compatibility with Windows Server environments. Use for Windows-specific automation on legacy systems. Triggers include "PowerShell 5.1", "Windows PowerShell", "WMI", "ADSI", "COM object", "legacy PowerShell".

🇯🇵 日本人クリエイター向け解説

一言でいうと

Windows PowerShell 5.1の専門家として、WMIやADSI、COMオブジェクトを活用し、レガシーなWindows環境での自動化を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o powershell-5-1-expert.zip https://jpskill.com/download/6712.zip && unzip -o powershell-5-1-expert.zip && rm powershell-5-1-expert.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/6712.zip -OutFile "$d\powershell-5-1-expert.zip"; Expand-Archive "$d\powershell-5-1-expert.zip" -DestinationPath $d -Force; ri "$d\powershell-5-1-expert.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して powershell-5-1-expert.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → powershell-5-1-expert フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

PowerShell 5.1 エキスパート

目的

レガシーな Windows 環境向けに Windows PowerShell 5.1 の専門知識を提供します。WMI クエリ、ADSI 操作、COM オートメーション、および古い Windows Server システムと互換性のあるスクリプトの保守に特化しています。

使用場面

  • Windows Server 2012/2016/2019 向けのスクリプト作成
  • システム管理のための WMI の操作
  • ADSI を介した Active Directory 操作
  • COM オートメーション (Office、レガシーアプリケーション)
  • 下位互換性の維持
  • DSC (Desired State Configuration)
  • Windows 固有の自動化
  • レガシースクリプトの保守

クイックスタート

このスキルを呼び出す場合:

  • Windows PowerShell 5.1 を具体的に使用している場合
  • システムクエリに WMI を使用している場合
  • ADSI または COM オブジェクトで自動化している場合
  • レガシーな PowerShell スクリプトを保守している場合
  • DSC 構成管理を行っている場合

呼び出さない場合:

  • クロスプラットフォーム PowerShell → /powershell-7-expert を使用してください
  • GUI/TUI 開発 → /powershell-ui-architect を使用してください
  • セキュリティ強化 → /powershell-security-hardening を使用してください
  • モジュールアーキテクチャ → /powershell-module-architect を使用してください

意思決定フレームワーク

PowerShell Version Context?
├── Must run on older Windows
│   └── Use 5.1 with WMI/ADSI
├── Cross-platform needed
│   └── Use PowerShell 7+ instead
├── AD Management
│   ├── Simple → ADSI
│   └── Complex → AD Module
└── System Info
    ├── Legacy → WMI
    └── Modern → CIM (also works in 5.1)

主要なワークフロー

1. WMI システムクエリ

  1. WMI クラス (Win32_*) を特定します
  2. WMI クエリを構築します
  3. Get-WmiObject または Get-CimInstance を使用します
  4. 結果を適切にフィルタリングします
  5. 出力をフォーマットします
  6. リモートシステムのエラーを処理します

2. ADSI 操作

  1. DirectoryEntry オブジェクトを作成します
  2. LDAP パスをナビゲートします
  3. 属性をクエリまたは変更します
  4. 変更する場合はコミットします
  5. 認証を処理します
  6. リソースをクリーンアップします

3. COM オートメーション

  1. New-Object -ComObject で COM オブジェクトを作成します
  2. オブジェクトモデルにアクセスします
  3. 操作を実行します
  4. COM エラーを処理します
  5. COM オブジェクトを適切に解放します
  6. [System.Runtime.InteropServices.Marshal] でクリーンアップします

ベストプラクティス

  • 可能な場合は WMI よりも CIM コマンドレットを使用します (リモート処理が優れています)
  • リモート操作には常にエラー処理を含めます
  • メモリリークを防ぐために COM オブジェクトを明示的に解放します
  • ターゲットの Windows バージョンでテストします
  • 必要な PowerShell モジュールを文書化します
  • 関数には承認された動詞を使用します

アンチパターン

アンチパターン 問題点 正しいアプローチ
COM を解放しない メモリリーク 明示的なクリーンアップ
低速ネットワークでの WMI パフォーマンスの問題 セッションで CIM を使用する
エラー処理がない サイレントな失敗 ログ記録を伴う Try/Catch
ハードコードされたパス 移植性の問題 環境変数を使用する
出力に Write-Host を使用する キャプチャできない Write-Output または return
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

PowerShell 5.1 Expert

Purpose

Provides expertise in Windows PowerShell 5.1 for legacy Windows environments. Specializes in WMI queries, ADSI operations, COM automation, and maintaining scripts compatible with older Windows Server systems.

When to Use

  • Scripting for Windows Server 2012/2016/2019
  • Working with WMI for system management
  • Active Directory operations via ADSI
  • COM automation (Office, legacy apps)
  • Maintaining backward compatibility
  • DSC (Desired State Configuration)
  • Windows-specific automation
  • Legacy script maintenance

Quick Start

Invoke this skill when:

  • Working with Windows PowerShell 5.1 specifically
  • Using WMI for system queries
  • Automating with ADSI or COM objects
  • Maintaining legacy PowerShell scripts
  • DSC configuration management

Do NOT invoke when:

  • Cross-platform PowerShell → use /powershell-7-expert
  • GUI/TUI development → use /powershell-ui-architect
  • Security hardening → use /powershell-security-hardening
  • Module architecture → use /powershell-module-architect

Decision Framework

PowerShell Version Context?
├── Must run on older Windows
│   └── Use 5.1 with WMI/ADSI
├── Cross-platform needed
│   └── Use PowerShell 7+ instead
├── AD Management
│   ├── Simple → ADSI
│   └── Complex → AD Module
└── System Info
    ├── Legacy → WMI
    └── Modern → CIM (also works in 5.1)

Core Workflows

1. WMI System Query

  1. Identify WMI class (Win32_*)
  2. Construct WMI query
  3. Use Get-WmiObject or Get-CimInstance
  4. Filter results appropriately
  5. Format output
  6. Handle errors for remote systems

2. ADSI Operations

  1. Create DirectoryEntry object
  2. Navigate LDAP path
  3. Query or modify attributes
  4. Commit changes if modifying
  5. Handle authentication
  6. Clean up resources

3. COM Automation

  1. Create COM object with New-Object -ComObject
  2. Access object model
  3. Perform operations
  4. Handle COM errors
  5. Release COM objects properly
  6. Clean up with [System.Runtime.InteropServices.Marshal]

Best Practices

  • Use CIM cmdlets over WMI when possible (better remoting)
  • Always include error handling for remote operations
  • Release COM objects explicitly to prevent memory leaks
  • Test on target Windows versions
  • Document required PowerShell modules
  • Use approved verbs for functions

Anti-Patterns

Anti-Pattern Problem Correct Approach
Not releasing COM Memory leaks Explicit cleanup
WMI over slow networks Performance issues Use CIM with sessions
No error handling Silent failures Try/Catch with logging
Hardcoded paths Portability issues Use environment variables
Write-Host for output Can't capture Write-Output or return