Get C# Core app to sucessfully use Powershell to call Python script in Azure Windows VM
Budget: $30 – $1,500 USD
We have an API app written in C#. The app instantiates Powershell, makes a Commands.AddScript call to insert a script which calls python scripts. This process works fine in a develop environment and on one Azure Windows VM but we are unable to replicate this process on other Azure Windows VMs.
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
PowerShell ps = PowerShell.Create();
ps.Commands.AddScript(@" """ + fileCopy + @""" | Out-File -FilePath " + scriptLocation + @"\powershell-test-output.txt"); //This works on
ps.Commands.AddScript(@".\python-output.py " );//This work in development plus one VM but not others
ps.Invoke();
runspace.Close();
Troubleshooting steps we have taken-
The python script runs fine from CMD or Powershell on the target VM
Python script works from the Azure control panel
We have expanded the permissions for the target directory.
The test API call successfully outputs a new file using Powershell alone.
We are seeing no errors in Event Viewer
API returns 200 response
You will need to troubleshoot using a screen sharing session. C# and Windows VM experts only please.
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
PowerShell ps = PowerShell.Create();
ps.Commands.AddScript(@" """ + fileCopy + @""" | Out-File -FilePath " + scriptLocation + @"\powershell-test-output.txt"); //This works on
ps.Commands.AddScript(@".\python-output.py " );//This work in development plus one VM but not others
ps.Invoke();
runspace.Close();
Troubleshooting steps we have taken-
The python script runs fine from CMD or Powershell on the target VM
Python script works from the Azure control panel
We have expanded the permissions for the target directory.
The test API call successfully outputs a new file using Powershell alone.
We are seeing no errors in Event Viewer
API returns 200 response
You will need to troubleshoot using a screen sharing session. C# and Windows VM experts only please.