Product: PowerShell Universal
Version: 2026.1.5
Hi, I wanted to reach out to you again regarding a different issue. Is there a way in PowerShell Universal to adjust an existing target script from within an app, using predefined Forms variables (two UD-Selects and one textbox)? I would like to use this app as a basis to revise the parameters of the respective scripts. Example:
New-UDApp -Content {
New-UDCard -Title "Test-App" -Content {
New-UDDivider
New-UDElement -Tag 'br'
New-UDStack -Direction 'column' -Spacing 3 -Content {
New-UDForm -Content {
New-UDSelect -Id 'SelectArt' -Label 'Art Selection' -Option {
New-UDSelectOption -Name 'IT' -Value 'IT'
New-UDSelectOption -Name 'Sales' -Value 'Sales'
New-UDSelectOption -Name 'Manager' -Value 'Manager'
} -DefaultValue 'Alle' -FullWidth
New-UDSelect -Id 'SelectOU' -Label 'OU Selection' -Option {
$ADSystemOUs = Get-ADOrganizationalUnit -Filter * -SearchBase $Searchbase -SearchScope OneLevel -Properties | Sort-Object Name
foreach ($ou in $ADSystemOUs) {
New-UDSelectOption -Name $ou.Name -Value $ou.DistinguishedName
}
} -FullWidth -Multiple
New-UDTextbox -Id 'TxtAdGroup' -Label 'AD-Group' -Placeholder 'AD-Group' -FullWidth
New-UDElement -Tag 'br'
} -OnSubmit {
$Art = $EventData.SelectArt
$OU = $EventData.SelectOU
$Group = $EventData.TxtAdGruppe
} -ButtonVariant outlined -SubmitText "Submit"
} -FullWidth
}
}
I would like to use the above-mentioned code, as described, to save an existing script (and others) with the data selected in the app. I know that I can use Get-PSUScript to call the respective scripts, but so far I have not found a way to pass information to them.