Azure Automation上のスクリプトをローカル環境でリモート実行するときに、少し時間が経つといつもつまずくことを備忘として記載します。
以下のURLにある通り、環境変数で設定しろ、書いてあるんですが、これが曲者。。。
PowerShell 7.2
To run PowerShell 7.2 runbooks on a Windows Hybrid Worker, install PowerShell on the Hybrid Worker. See Installing PowerShell on Windows.
After PowerShell 7.2 installation is complete, create an environment variable with Variable name as powershell_7_2_path and Variable value as location of the executable PowerShell. Restart the Hybrid Runbook Worker after environment variable is created successfully.
「as location of the executable PowerShell」と書いてあるので、普通はpwsh.exeのあるフォルダを指定したくなるところ。でも、うまくいかず。
pwsh.exeを含めた環境パスにしなくては行けないようです。
環境変数
powershell_7_2_path=C:\Program Files\PowerShell\7\pwsh.exe
Comments