New-UDInputField -Type "textbox" -Name "accLookup" -Placeholder "Enter Name"
} -Endpoint {
param($accLookup)
# Takes the input from above and searches $Cache:AllUsers to see if we have a match.
$Objects = $Cache:AllUsers | Where-Object {($_.DisplayName -like "*$accLookup*") -or ($_.SamAccountName -like "*$accLookup*") -or ($_.name -like "*$accLookup*")}
# We found some matches in $Cache:AllUsers, lets list them out.
Set-UDElement -Id "results" -Content {
New-UDGrid -Id "$accLookup Results" -Title "Search Results for: $accLookup" -Headers @("Username", "Name", "More Info", "Password Reset") -Properties @("Username", "Name", "MoreInfo", "ResetPW") -Endpoint {
$Objects | ForEach-Object {
$sid = $_.SamAccountName
[PSCustomObject]@{
Username = $_.UserPrincipalName
Name = $_.DisplayName
# This button will load a dynamic page that gives more options
MoreInfo = New-UDButton -Text "Get Details" -OnClick {Invoke-UDRedirect -Url "/$sid"} -Id "$sid Get Details"
# This button will reset their password.
ResetPW = New-UDButton -Text "Reset Password" -OnClick {Invoke-UDRedirect -Url "mailto:[[REDACTED]]?cc=$($_.UserPrincipalName)&subject=PW Reset - $($_.Surname)&body=$($_.UserPrincipalName)" } -Id "$sid Reset Password"
}
} | Out-UDGridData
}
}
}
Best i can offer is this, which is what i use in my dashboard. However, this is a 2.9 dashboard and not a Universal one because i haven’t had the motivation to rebuild everything to migrate to PSU.