I have an issue when I work with a responsive form and I can't figure why. I have all the Jobs tracker functions loaded, the timer, etc.
When I try to find a specific user that I type on a textbox, the job get-aduser -identity $result apparently it is empty but if I run this outside the job script it works. Do you know if I have to import somehow the $result variable inside the Jobscript?
here is the part of the code that it is failing, let me know if it will be better to upload the entire form.
Code: Select all
[/Codebox
$textboxFind_TextChanged= {
#TODO: Place custom script here
$loadplane.Visible = $true
Add-JobTracker -Name "ADuser"`
-JobScript {
$result = "$($textboxiFind.text)*" #take the info that i type inside a textbox e.j: jhon.contoso
$global:progresspreference = 'SilentlyContinue'
Get-ADUser -Identity $result ### Here appears the error, no mather what I use or put inside the $result variable it is always null but if I manually set the user it works E.j Get-ADUser -Identity jhon.contoso
}`
-CompletedScript {
Param ($Job)
$Users = Receive-Job -Job $Job
Write-Host $Users ## i'm using this just to see if the jub is retreving something
$textboxFind.SelectionLength = 0
$textboxFind.SelectionStart = $result.Length
#Update-Combobox $textboxFind -Items $users
$loadplane.Visible = $false
}`
-UpdateScript {
Param ($Job)
$results = Receive-Job -Job $Job | Select-Object -Last 1
}
}
]
Thanks, best regards.