Hello everyone, I am fairly new to PU and powershell in general so any help is apreciated.
I am trying to display some scripts for the enduser made in PU via a table. The problem I am currently facing is that I try to collect some kind of data when running a script which I can use to disable all Buttons while this job is running. But it seems there is no Output I can use from Invoke-PSUScript or Get-PSUJobOutput.
$Columns = @(
New-UDTableColumn -Property run -Title 'Ausführen' -Width 5 -Render {
$Page:Icon = New-UDIcon -Id "DynIcon" -Icon playcircle -Size 1x
$Page:RunButtons = New-UDButton -Id "btn$($EventData.Skriptname)" -Icon $Page:Icon -OnClick {
$outscript = Invoke-PSUScript -Name $EventData.Skriptname # -Wait
$outscript | Out-File -Path "C:\_temp\debugfiles\outscript.txt"
# this is some pseudocode I am trying to achieve
if ($outscript) { $jobdone = $true }
while(!$jobdone) {
Set-UDElement -Id "btn*" -Properties @{ disbale = $true }
if ($jobdone) {
Set-UDElement -Id "btn*" -Properties @{ disbale = $false }
break
}
}
# Output loggen
$Job = Get-PSUScript -Name $EventData.Skriptname | Get-PSUJob -OrderDirection Descending -First 1
#$Pipe = Get-PSUJobPipelineOutput -Job $Job
$JobOutput = Get-PSUJobOutput -Job $Job
$JobOutput | Out-File -Path "$($Page:LogPath)\$($Page:Date)_$($EventData.Skriptname)_Output.txt"
}
$Page:RunButtons
}
New-UDTableColumn -Property Skriptname -Title "Skriptname" -IncludeInSearch
New-UDTableColumn -Property Beschreibung -Title "Beschreibung"
)
$outscript has no value which I would try to use as a bool value to run a while-loop