I'm trying to get python to run a PowerShell script over Windows RM, because of the encoding I inject the parameters into the top of the file, however this means I need to remove the existing Param function, I've nearly managed to get the regex working but the "Parameter(Mandatory)" section that is sometimes there is messing up my regex, can someone help me fix it please.
I don't want it to match the word Param that might be elsewhere in the script.
......
Param(
[Parameter(Mandatory)]
[String]$TaskName,
[Switch]$Debug = $false
)
# Debug
if ($Debug)
Python 2.7 command:
args = re.sub("Param(\s*\r*\n[^)]+)", "", scriptfile.read(), re.M )