2025年4月19日土曜日

Visual Studio CodeからGitHub Copilotを使ってみた

Windows Admin Center 2410 (WAC 2410と略す)に付属するPowerShellモジュールであるMicrosoft.WindowsAdminCenter.Configurationに含まれるコマンドレット名とSYNOPSISを抽出したく、まず下図のとおりコマンドを実行しました。

出力させたファイルの一部を下記に添付します。

NAME
    Add-WACCertificates
    
SYNOPSIS
    [PLACEHOLDER] Adds the saved certificates used by GW to this server.
    
    
SYNTAX
    Add-WACCertificates [-ExitWithErrorCode] [<CommonParameters>]
    
    
DESCRIPTION
    Add the certficates whose thumprints are saved in appsettings.json to this node. The file paths for the .cer files
    will also be available in settings.json.

補足)Get-Helpで説明をうまく出力できなかったコマンドレットが複数ありました。

Get-Helpコマンドレットを使っているので、その書式どおりです。とはいえここからSYNOPSISだけコピー&ペーストするのは効率が悪いですね。

そこで表題の通り、Visual Studio CodeからGitHub Copilotを使ってみました。プロンプトを微調整して指定した(配下を直下と指定しなおした)ものが下記です。


良い感じのコードを生成してくれました。出力結果をソートするようにプロンプトで指定すればなおよかったようです。上記画面の左下に抽出結果も出ています。念のため抽出結果の抜粋を下記に貼ります。

Name                                    Synopsis
----                                    --------
Add-WACCertificates                     [PLACEHOLDER] Adds the saved certificates used by GW to this server.
Add-WACSetupStartMenuShortcut           Adds a start menu shortcut to the "WindowsAdminCenterSetup" executable.
Add-WACSideloadSite                     Add WAC sideload site.


0 件のコメント:

コメントを投稿