I have a Python Script as shown below stored in a remote computer.
print("hello")
a=input("d")
print(a)
Im trying to execute this script from my local machine through PowerShell using Invoke-Command as shown below.
Invoke-Command -computername COMP1 -credential COMP1\user -scriptblock {python C:\Temp\a.py}
But getting the below error, which has to do with input line which is used in the Python Script.
Traceback (most recent call last):
CategoryInfo : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException
FullyQualifiedErrorId : NativeCommandError
PSComputerName : COMP1
File "C:\Temp\a.py", line 2, in <module>
a=input()
EOFError: EOF when reading a line
Any suggestion on how to proceed with this?
CodePudding user response:
This solution is only for a sample code, but should be able to implement it similarly for a complex script where we need to input multiple variables.