I add a button-Start Job to a form and wish to run a function A defined in Global.ps1 when I click this button. I directly write $result = Invoke-expression A in JobScript, but it seems does not work. Please refer to the sample code here. Thank you very much.
$paramAddJobTracker = @{
Name = 'JobName'
JobScript = {
#--------------------------------------------------
Param ()
$result = Invoke-Expression A
return $result
#--------------------------------------------------
}
ArgumentList = $null
CompletedScript = {
Param ([System.Management.Automation.Job]$Job)
$result = Receive-Job -Job $Job
#Enable the Button
$buttonStartJob.ImageIndex = -1
$buttonStartJob.Enabled = $true
}
Urgent!! How to use invoke-expression functionName when I click Button-Start Job in
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.