Dashboard to get user input server statistics

HI I am still a powershell newb but im trying to make a dashboard where a user can go to the homepage, enter in a server name and get back a bunch of specifics on the server.

I want to be able to have a bunch of invoke-commands run in the background then display things like the system time, memory usage, cpu usage, drive space, last 10 event log errors.

Is that possible with this tool. I created a dashboard with an input action that saves the server name as a variable called $server the i set an input action to create a new card and display the information but its not working.

any help would be greatly appreciated

Hey Gerard - sounds like a nice idea!

Can you post a sample script from your project?

Myself and many forum members would be happy to send you some samples / tips but if you could send a simplified version of your script we could whip something up really fast for you!

this is what i have so far. i may be completely on the wrong track but i want to input the server name and then bring back either different cards or different tables with the info for that server in it.

Thank you for the help.

Import-Module UniversalDashboard.Community

$Username = ‘administrator’
$Password = ‘Labuser$1’
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass

$Init = New-UDEndpointInitialization -Variable “Server”

$Dashboard = New-UDDashboard -Title “HealthCheck Dashboard” -Content {

    New-UDInput -Title "Enter Server" -Endpoint {
        param (
    New-UDCard -Title "Server Time" -Endpoint {
    Invoke-Command -ComputerName $server -Credential $Cred -ScriptBlock {get-date}

    New-UDCard -Title "Hard Drive Space" -Endpoint {
    Invoke-Command -ComputerName $server -Credential $Cred -ScriptBlock {Get-PSDrive}

} -EndpointInitialization $Init

Start-UDDashboard -Dashboard $Dashboard -Port 8080 -AutoReload

Hi @gerard thanks for posting your code and your question. Seen you been waiting a few days, so thought maybe I could chip-in and help out. I recently finished a complaints dashboard, and I wanted to provide a chart based on a user selecting a date period…So I went with the old-skool way of simply outputting these results to the current directory for that user to a text file, of the TWO selected dates, I then test if that path exists and if so the chart uses the dates from the text file. I define the $Root at the top of my dashboard script as a variable to the current directory…anyway heres my code and hopefully this will help:-

New-UDTab -Text “Custom” -Content {
New-UDRow -Columns {
New-UDColumn -Size 3 -Content {
New-UDCard -Endpoint {
New-UDInput -Title “Select Range (DAY/MONTH/YEAR)” -Id “DateForm” -Content {
New-UDInputField -Type ‘date’ -Name ‘DateFrom’ -Placeholder ‘FROM:’
New-UDInputField -Type ‘date’ -Name ‘DateTo’ -Placeholder ‘TO:’

                } -Endpoint {
                    $var = get-date $DateFrom
                    $DateFormat = $var.ToString('yyyy-MM-dd')
                    $var2 = get-date $DateTo
                    $DateFormat2 = $var2.ToString('yyyy-MM-dd')
                    if (-Not(Test-Path $Root\$User)) { mkdir $Root\$User }
                    if (Test-path $Root\$User\search.txt)
                    { Remove-Item -Path "$Root\$User\search.txt" }
                    $DateFormat | Out-File (Join-Path $Root\$User "search.txt")
                    $DateFormat2 | Out-File (Join-Path $Root\$User "search.txt") -Append
                    New-UDInputAction -Toast "$DateFormat to $DateFormat2" -duration 2000

        New-UDColumn -Size 9 -Content {
            New-UDCard -Content {
                New-UDChart -Type Line -Id 'chart2' -Title "Complaints Logged By Month" -FontColor "#ffffff" -BackgroundColor "#1e353f" -Endpoint {
                    if (Test-Path $Root\$User\search.txt) {
                        $dates = Get-Content $Root\$User\search.txt

                        $CusQuery2 = @"
    SELECT COUNT(loggeddate)Logged
    ,convert(varchar,LoggedDate,103) LoggedDate
      FROM [COMPLAINT].[dbo].[Main]
      WHERE LoggedDate BETWEEN '$($dates[0])' AND '$($dates[1])'
      GROUP BY LoggedDate
                        $q14 = Invoke-Sqlcmd2 -ServerInstance YOUR_SQL_SERVER -Database COMPLAINT -Query $CusQuery2 -Username 'YOUR USERNAME' -Password 'YOUR PASSWORD'
                        $q14 | select-object Logged, LoggedDate | Out-UDChartData -LabelProperty "LoggedDate" -DataProperty "Logged" -Dataset @(
                            New-UDChartDataset -DataProperty "Logged" -Label "Complaints Recorded")

                } -AutoRefresh -RefreshInterval 5 -Options (
                    New-UDLineChartOptions -TooltipOptions (New-UDChartTooltipOptions -TitleFontSize 24 -BodyFontSize 20)