Quantcast
Channel: SAPIEN Forums
Viewing all articles
Browse latest Browse all 311

PowerShell GUIs • Add-JobTracker and passing ArgumentList how ??

$
0
0
i try to pass computername to the argumentlist ind the paramAddJobTracker
but it doesnt get passed am i doing it the wrong way?

Code:

$button_StartJob_Click={$ComputerName = "lb00926"$button_StartJob.Enabled = $false#Create a New Job using the Job Tracker$paramAddJobTracker = @{Name  = 'JobName'JobScript = {Param ($ComputerName) #Pass any arguments using the ArgumentList parameterTest-Connection -ComputerName $ComputerNameWrite-Output $ComputerName}ArgumentList = $ComputerNameCompletedScript = {Param ([System.Management.Automation.Job]$Job)$results = Receive-Job -Job $JobWrite-Host "$result"#Enable the Button$button_StartJob.ImageIndex = -1$button_StartJob.Enabled = $true}UpdateScript = {Param ([System.Management.Automation.Job]$Job)#$results = Receive-Job -Job $Job -Keep#Animate the Buttonif ($null -ne $button_StartJob.ImageList){if ($button_StartJob.ImageIndex -lt $button_StartJob.ImageList.Images.Count - 1){$button_StartJob.ImageIndex += 1}else{$button_StartJob.ImageIndex = 0}}} } Add-JobTracker @paramAddJobTracker}

Statistics: Posted by lontru — Mon May 13, 2024 2:52 am — Replies 1 — Views 16



Viewing all articles
Browse latest Browse all 311

Trending Articles