How can I get the result of my script on to the page? I’ve started off easy and just trying to get the LAPS password and show it to the user.
My script blocks are running as I can see the password within the toast but I can’t see to find any way to display it back on the page. I’ve tried adding new paragraphs, cards, pages etc but they all just show blank and don’t update when hitting submit.
$Page2 = New-UDPage -Name “LAPS” -Icon key -Content {
New-UDInput -Title "Select me" -Endpoint {
param([ValidateSet("Domain1.Local", "Domain2.local")]$SelectedDomain,
[string]$ComputerName)
If ($SelectedDomain -like "Domain1.Local") {
$LAPSpassword = Get-ADComputer -Filter {name -like $ComputerName} -SearchBase 'DC=Domain1,DC=local' -Server 'Domain1.local' -Properties ms-Mcs-AdmPwd | Select-Object ms-Mcs-AdmPwd
}
if ($SelectedDomain -like "Domain2.local") {
$LAPSpassword = Get-ADComputer -Filter {name -like $ComputerName} -SearchBase 'DC=Domain2,DC=local' -Server 'Domain2.local' -Properties ms-Mcs-AdmPwd | Select-Object ms-Mcs-AdmPwd
}
# This toast works and shows password
New-UDInputAction -Toast "Laps Password is: $LAPSpassword"
# These don't work.
New-UDParagraph -Text "$LAPSpassword"
New-UDParagraph -Text "$SelectedDomain"
} -FontColor "black"
}