Product: PowerShell Universal
Version: 4.2.8
Hey guys and gals,
Pretty new to this PSU stuff, and I’m having a little issue that I can’t seem to solve!
Here’s my code that works:
Set-UDElement 'tree' -content {
Get-ADOrganizationalUnit -Filter * -Server mydomaincontroller.my.domain.com.au -Searchbase 'OU=OUName,DC=my,DC=domain,DC=com,DC=au' -SearchScope 1 -Properties canonicalname,distinguishedname | select name,canonicalname,distinguishedname | sort name | ForEach-Object {
New-UDTreeView -Id 'selectOU' -Node { New-UDTreeNode -Name $_.Name -Id $_.DistinguishedName } -OnNodeClicked {
Get-ADorganizationalUnit -Filter * -Searchbase $EventData.id -SearchScope 1 -properties canonicalname,distinguishedname | select canonicalname, distinguishedname,name | ForEach {
New-UDTreeNode -Name "$($_.Name)" -Id "$($_.distinguishedname)" -Leaf:$(-not $_.distinguishedname)
}
$Global:Value = $EventData.id
Set-UDElement 'SelectedOU' -Content {
New-UDTextbox -Value $Value -Label "Selected OU" -FullWidth -Icon 'folder'
}
Show-UDToast $Global:Value
}
With this code, the Toast and the Text Box shows the OU selected, even if it’s a child OU.
However, if I add the following to the New-UDTextBox it will only EVER show the parent OU in the text box and stored in the value, but will show the child OU selected in the Toast:
Set-UDElement 'SelectedOU' -Content {
New-UDTextbox -Value $Value -Label "Selected OU" -FullWidth -Icon 'folder' -id 'wheretoput'
}
Literally just putting an ID parameter on the text box stops it from showing what I need it to. Is this a bug?
If I don’t add the ID parameter, it labels the field as a random GUID and I can’t use that parameter to pass to the script that runs after the information has been collected.
Hopefully all of this makes sense!
Cheers,
Dave