Displaying output as function complete

I am working on backup restore functionality with Universal Dashboard. I am able to perform task. There is an enhancement scope such as to display the task name as it complete like backup done, login script generated and so on.
Currently user just look into a default circle which is that something is happening but it is not so meaning full.

Am using UD to backup and restore DBs and i have a card that shows paragraph for each step the process do especially if there is an error or if the backup and restore completed.
it works really well as a live logging UI for end users when they click the button to perform the backup task.

Thank you for reply @wsl2001

in my case I am actually taking input from user and then processing at once, like all the code is written in the endpoint with main block in new-udinputaction -Content

as mentioned, I am doing multiple steps, like scripting login, taking backup, putting in S3 bucket and sending email. till the time all the steps are not completed user do not get any update.

It will be a good help if you could share the how you implemented it

New-UDCard -Id "Card" -Title "Results"

and before or after each step in your code and whenever you want to show the user what is going on at this step you do something like this

    Set-UDElement -Id "Card" -Content { New-UDParagraph -Text "Starting Service please wait..." }

    start-sleep 6

    Set-UDElement -Id "Card" -Content { New-UDParagraph -Text "Service Started." }

Hi @wsl2001 ,
I tried but the UDElement is not working, I am providing the UD script so that you can help me or regenerate the issue.

$Dashboard = New-UDDashboard -Title "Input Quantity" -Content {
    New-UDInput -Title 'Specify On-premise SQL Instance and Target SQL Version and environment' -Endpoint {
        [Parameter(Mandatory = $true, HelpMessage = "instance Name")]
        [UniversalDashboard.ValidationErrorMessage("SQL instance not found!")] [string]$instancename
    new-udinputaction -Content @(
    $DB=(Get-ValidateSetDatabases | Where-object INSTANCEID -eq $instancename).DATABASE
New-UDInput -Title "Input that should have valid value" -Id "TestInput" -Content {
    New-UDInputField -Name DNname -Type select -Values $DB
} -Endpoint {
    param (
    new-udinputaction -Content @(
    New-UDHtml -Markup "<p><b> You have selected following details</b> <br/>
                        SQL Server : $instancename<br/>
                        Target Version : $Session:cachedTargetVersion<br/>
                        Targert Environment : $TargetSQLVersion<br/>
                        Database Name : $DNname</p>"
    ######### Login script
    Invoke-Sqlcmd -ServerInstance $instancename -Database $DNname -InputFile "C:\inetpub\wwwroot\Script User and Login.sql" -verbose 4>&1 | out-file  "D:\backup\Login_script.sql" -Append -Force -Width 5000

    ######### Backup 
    $BackupFile = "D:\Backup\$DNname.$timestamp.bak"

    Invoke-Sqlcmd -ServerInstance $instancename -Database master -Query $Query -QueryTimeout 0 -verbose 4>&1 | Out-File -FilePath $localDebugLog -Append -Force 

   New-UDCheckbox -Label 'Backup completed' -Checked -FilledIn

} -Validate

Let me know in case you need more information.

@adam , can you help here. If there will be good training for end to end training for UDelement and endpoint.


you need to create a card first, the card is an element with id , so when you do any step before or after if you use the command set-udelement as per my example when powershell reach that step you will see a text in the card shows what ever you provide like a logging screen.

Set-UDElement -Id “Card” -Content { New-UDParagraph -Text “Starting Service please wait…” }

to understand it better think about it like write-host or write-output command in powershell to show a custom txt you provide or to show an output of a command if it has an error or warning …etc

am doing a backup and restore dbs with UD and dbatools and i even have a progress to show user how much percentage completed of each task.
it just works.