リモートPCでPythonスクリプトを実行するPowerShellスクリプトを作成したいと思います。スクリプトは、実行を続行するために「Y」または「N」を入力するようにユーザーに促します。
リモートでログインするには、次のように入力します
enter-pssession -ComputerName <Computer Name> -Credential <DOMAIN>\<username>
次に、次のように入力します。
python ".\update_software.py"
スクリプトはプロンプトの前にテキストを出力しますが、プロンプトの代わりに次のエラーメッセージが表示されます。
python.exe : Traceback (most recent call last):
+ CategoryInfo : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
File ".\update_software.py", line 19, in <module>
_runner.execute()
File "C:\aimplatform2\aim\software_updater\run_update.py", line 76, in execute
res = raw_input("> ")
EOFError: EOF when reading a line
それが役に立ったら、私はWindows XPを実行していて、WindowsXPマシンにリモート接続しています。