I want to execute following power shell script from C# code
Add-Content D:\f.txt "Import Module"
Add-Content D:\f.txt "Remove Module"
Add-Content D:\f.txt "The End"
exit 4
I can execute the script from the C# code successfully.
I want my C# program to read the exit value (i.e. 4) returned from the powershell.
Can you please let me know how I can achieve it? Note: I am new to C# and powershell.