I have a script that I can run from the command line, but when I try to call it from a C# program I get an error.
Script:
Param($VarA)
Write-Host $VarA
When I run it, I get a CommandNotFoundException with the message "The term 'param' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again."
Any suggestions?
If I remove the Param from the top of the script, it runs fine. I set the values with
.SessionStateProxy.SetVariable(...), but would like to be able to test and run without changing the script.