Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Input controls for Universal Dashboard
Protect sections based on roles.
Protect-UDSection -Role @("Administrator") -Content {
New-UDTypography -Text 'Only Administrators see this'
}New-UDMarkdown -Markdown "
# Header
- List Item 1
- List Item 2
## Sub Header
"$ENV:UniversalAutomation__Queues = "windows7""UniversalAutomation": {
"Queues": ["windows7"],
}New-UDImage -Url "https://ironmansoftware.com/img/ps-logo.png"New-UDImage -Path C:\users\adamr\Desktop\ps-logo.pngNew-UDImage -Url "https://ironmansoftware.com/img/ps-logo.png" -Width 250 -Height 250New-UDImage -Url "https://ironmansoftware.com/img/ps-logo.png" -Attributes @{
alt = "Ironman Software Logo"
}Examples of things you can do with dashboards.
New-UDDashboard -Title 'Processes' -Content {
$Processes = Get-Process | Select-Object Id, Name
New-UDTable -Columns @(
New-UDTableColumn -Property 'Id' -Title 'Id'
New-UDTableColumn -Property 'Name' -Title 'Name'
) -Data $Processes -ShowPagination
}Alert component for Universal Dashboard.
New-UDAlert -Severity 'error' -Text 'This is an error alert — check it out!'
New-UDAlert -Severity 'warning' -Text 'This is an warning alert — check it out!'
New-UDAlert -Severity 'info' -Text 'This is an error info — check it out!'
New-UDAlert -Severity 'success' -Text 'This is an success alert — check it out!'New-UDTreeView -Node {
New-UDTreeNode -Name 'Level 1' -Children {
New-UDTreeNode -Name 'Level 2 - Item 1'
New-UDTreeNode -Name 'Level 2 - Item 2'
New-UDTreeNode -Name 'Level 2 - Item 3' -Children {
New-UDTreeNode -Name 'Level 3'
}
}
}New-UDDashboard -Title 'File System' -Content {
Get-PSDrive -PSProvider 'FileSystem' | ForEach-Object {
New-UDTreeView -Node { New-UDTreeNode -Name $_.Name -Id "$($_.Name):\" } -OnNodeClicked {
Get-ChildItem $EventData.Id | ForEach-Object {
New-UDTreeNode -Name $_.Name -Id $_.FullName -Leaf:$(-not $_.PSIsContainer)
}
}
}
}New-UDDashboard -Title 'Dashboard' -Content {
New-UDTypography -Text 'Hello, world!'
}@("h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2", "body1", "body2",
"caption", "button", "overline", "srOnly", "inherit",
"display4", "display3", "display2", "display1", "headline", "title", "subheading") | ForEach-Object {
New-UDTypography -Variant $_ -Text $_ -GutterBottom
New-UDElement -Tag 'p' -Content {}
}New-UDLink -Text 'Ironman Software' -Url https://www.ironmansoftware.com



New-PSUSystemEvent -Script "systemEvent.ps1" -Environment "Default" -Credential "Default" -Type "Create" -Condition "TargetInstance isa `"Win32_Process`" and TargetInstance.Name = `"pwsh.exe`"" -Name "PowerShell Started"
New-UDTooltip -Content {
New-UDIcon -Icon 'User'
} -TooltipContent {
"User"
} -Place 'bottom'



New-UDDashboard -Title 'Processes' -Content {
Get-PSDrive -PSProvider 'FileSystem' | ForEach-Object {
New-UDTreeView -Node { New-UDTreeNode -Name $_.Name -Id "$($_.Name):\" } -OnNodeClicked {
Get-ChildItem $EventData.Id | ForEach-Object {
New-UDTreeNode -Name $_.Name -Id $_.FullName -Leaf:$(-not $_.PSIsContainer)
}
}
}
}New-UDDashboard -Title 'New User' -Content {
New-UDForm -Content {
New-UDTextbox -Id 'UserName' -Label "User Name"
New-UDTextbox -Id 'Password' -Label 'Password' -Type 'password'
} -OnSubmit {
$Password = $EventData.Password | ConvertTo-SecureString -AsPlainText
New-LocalUser -Name $EventData.UserName -Password $Password
Show-UDToast "New user $($EventData.UserName) was created!"
}
}New-UDDashboard -Title 'Clock' -Content {
New-UDDynamic -Id 'clock' -Content {
(Get-Date).ToString('T')
} -AutoRefresh -AutoRefreshInterval 1
New-UDButton -Text 'Toggle Clock' -OnClick {
Set-UDElement -Id 'clock' -Properties @{
autoRefresh = -not( (Get-UDElement -Id 'clock').AutoRefresh)
}
}
}param($TargetInstance)
New-BurntToastNotification -Text "PowerShell Started! $TargetInstance"New-UDTooltip -Content {
New-UDIcon -Icon 'User'
} -TooltipContent {
New-UDPaper -Children {
"User"
}
}New-UDTooltip -Content {
New-UDIcon -Icon 'User'
} -TooltipContent {
"User"
} -Type 'success'innerWidth |xs sm md lg xl
|--------|--------|--------|--------|-------->
width | xs | sm | md | lg | xl
smUp | show | hide
mdDown | hide | showNew-UDHidden -Up xl -Content {
New-UDTypography 'xl'
}New-UDHidden -Down xs -Content {
New-UDTypography 'xs'
}New-UDHidden -Only 'sm' -Content {
New-UDTypography 'sm'
}
New-UDHidden -Only @('sm', 'xl') -Content {
New-UDTypography 'sm,xl'
}New-UDDateTime -InputObject (Get-Date)New-UDDateTime -InputObject (Get-Date) -Format 'DD/MM/YYYY'New-UDDateTime -InputObject (Get-Date) -Locale 'es'New-UDStack -Content {
New-UDPaper -Content { "Item 1" } -Elevation 3
New-UDPaper -Content { "Item 2" } -Elevation 3
New-UDPaper -Content { "Item 3" } -Elevation 3
} -Spacing 2 -Direction 'column'New-UDBadge -BadgeContent { 4 } -Children {
New-UDIcon -Icon Envelope -Size 2x
} -Color secondary
New-UDBadge -BadgeContent { 4 } -Children {
New-UDIcon -Icon Envelope -Size 2x
} -Color success New-UDLink -Text 'Ironman Software' -Url https://www.ironmansoftware.com -Variant h2 -Underline alwaysNew-UDLink -Text 'Ironman Software' -Url https://www.ironmansoftware.com -OpenInNewWindowNew-UDLink -Text 'Ironman Software' -OnClick {
Show-UDToast "Hello!"
}
New-UDTimePickerNew-UDDrawer -Variant 'permanent' -Content {
New-UDList -Children {
New-UDListItem -Label "Home"
New-UDListItem -Label "Getting Started" -Children {
New-UDListItem -Label "Installation" -OnClick {}
New-UDListItem -Label "Usage" -OnClick {}
New-UDListItem -Label "FAQs" -OnClick {}
New-UDListItem -Label "System Requirements" -OnClick {}
New-UDListItem -Label "Purchasing" -OnClick {}
}
}
}New-UDAlert -Severity 'error' -Content { New-UDHtml 'This is an error alert — <strong>check it out!</strong>' } -Title "Error"
New-UDAlert -Severity 'warning' -Content { New-UDHtml 'This is an warning alert — <strong>check it out!</strong>' } -Title "Warning"
New-UDAlert -Severity 'info' -Content { New-UDHtml 'This is an error info — <strong>check it out!</strong>' } -Title "Info"
New-UDAlert -Severity 'success' -Content { New-UDHtml 'This is an success alert — <strong>check it out!</strong>' } -Title "Success"New-UDProgressNew-UDFloatingActionButton -Icon (New-UDIcon -Icon user) -Size Small
New-UDFloatingActionButton -Icon (New-UDIcon -Icon user) -Size Medium
New-UDFloatingActionButton -Icon (New-UDIcon -Icon user) -Size LargeNew-UDGridLayout -Content { 1..10 | ForEach-Object { New-UDPaper -Id "Paper$" -Content { New-UDTypography -Text $ } -Elevation 5 } } -Design



Set-PSUSetting -ApiEnvironment '7.1'New-PSUEndpoint -Url /environment -Environment Integrated -Endpoint {
$PSUEnvironment
} New-UDButton -Variant 'contained' -Text 'Default'New-UDButton -Variant 'outlined' -Text 'Default'New-UDButton -Id "Submit" -Text "Submit" -Style @{ Width = "150px"; Height = "100px" }New-UDButton -Icon (New-UDIcon -Icon trash) -Text 'Delete'New-UDButton -Text 'Message Box' -OnClick {
Show-UDToast -Message 'Hello, world!'
}New-UDButton -Text 'Message Box' -OnClick {
Show-UDToast -Message 'Hello, world!'
Start-Sleep 10
} -ShowLoadingNew-UDRating New-UDRating -OnChange {
Show-UDToast $EventData
}New-UDRating -Max 10New-UDRating -Precision .5New-UDRating -Size largeNew-UDTransferList -Item {
New-UDTransferListItem -Name 'test1' -Value 1
New-UDTransferListItem -Name 'test2' -Value 2
New-UDTransferListItem -Name 'test3' -Value 3
New-UDTransferListItem -Name 'test4' -Value 4
New-UDTransferListItem -Name 'test5' -Value 5
} New-UDTransferList -Item {
New-UDTransferListItem -Name 'test1' -Value 1
New-UDTransferListItem -Name 'test2' -Value 2
New-UDTransferListItem -Name 'test3' -Value 3
New-UDTransferListItem -Name 'test4' -Value 4
New-UDTransferListItem -Name 'test5' -Value 5
} -OnChange {
Show-UDToast ($EventData | ConvertTo-Json)
}New-UDForm -Content {
New-UDTransferList -Item {
New-UDTransferListItem -Name 'test1' -Value 1
New-UDTransferListItem -Name 'test2' -Value 2
New-UDTransferListItem -Name 'test3' -Value 3
New-UDTransferListItem -Name 'test4' -Value 4
New-UDTransferListItem -Name 'test5' -Value 5
}
} -OnSubmit {
Show-UDToast ($EventData | ConvertTo-Json)
}New-UDTabs -Tabs {
New-UDTab -Text 'Item One' -Content { New-UDTypography -Text 'Item One' -Variant 'h2' }
New-UDTab -Text 'Item Two' -Content { New-UDTypography -Text 'Item Two' -Variant 'h2' }
New-UDTab -Text 'Item Three' -Content { New-UDTypography -Text 'Item Three' -Variant 'h2' }
}New-UDTabs -Tabs {
New-UDTab -Text 'Item One' -Content { New-UDTypography -Text 'Item One' -Variant 'h2' }
New-UDTab -Text 'Item Two' -Content { New-UDTypography -Text 'Item Two' -Variant 'h2' }
New-UDTab -Text 'Item Three' -Content { New-UDTypography -Text 'Item Three' -Variant 'h2' }
} -Orientation verticalNew-UDTabs -Tabs {
New-UDTab -Text 'Item One' -Content { Get-Date } -Dynamic
New-UDTab -Text 'Item Two' -Content { Get-Date } -Dynamic
New-UDTab -Text 'Item Three' -Content { Get-Date } -Dynamic
} -RenderOnActiveNew-UDTabs -Tabs {
New-UDTab -Text 'Item One' -Content { New-UDTypography -Text 'Item One' -Variant 'h2' } -Icon (New-UDIcon -Icon Users)
New-UDTab -Text 'Item Two' -Content { New-UDTypography -Text 'Item Two' -Variant 'h2' } -Icon (New-UDIcon -Icon Desktop)
New-UDTab -Text 'Item Three' -Content { New-UDTypography -Text 'Item Three' -Variant 'h2' } -Icon (New-UDIcon -Icon Exclamation)
}New-UDTimePicker -Locale frNew-UDTimePicker -DisableAmPmNew-UDSwitch -Checked $true
New-UDSwitch -Checked $true -DisabledNew-UDSwitch -OnChange { Show-UDToast -Message $EventData }New-UDSwitch -Id 'switch'
New-UDButton -Text 'Click' -OnClick {
Show-UDToast -Message (Get-UDElement -Id 'switch').checked
}New-UDList -Content {
New-UDListItem -Label 'Inbox' -Icon (New-UDIcon -Icon envelope -Size 3x) -SubTitle 'New Stuff'
New-UDListItem -Label 'Drafts' -Icon (New-UDIcon -Icon edit -Size 3x) -SubTitle "Stuff I'm working on "
New-UDListItem -Label 'Trash' -Icon (New-UDIcon -Icon trash -Size 3x) -SubTitle 'Stuff I deleted'
New-UDListItem -Label 'Spam' -Icon (New-UDIcon -Icon bug -Size 3x) -SubTitle "Stuff I didn't want"
}New-UDList -Content {
New-UDListItem -Label 'Inbox' -Icon (New-UDIcon -Icon envelope -Size 3x) -SubTitle 'New Stuff'
New-UDListItem -Label 'Drafts' -Icon (New-UDIcon -Icon edit -Size 3x) -SubTitle "Stuff I'm working on "
New-UDListItem -Label 'Trash' -Icon (New-UDIcon -Icon trash -Size 3x) -SubTitle 'Stuff I deleted'
New-UDListItem -Label 'Spam' -Icon (New-UDIcon -Icon bug -Size 3x) -SubTitle "Stuff I didn't want" -OnClick {
Show-UDToast -Message 'Clicked'
}
}New-UDCheckBox
New-UDCheckBox -Disabled
New-UDCheckBox -Checked $true
New-UDCheckBox -Checked $true -Disabled$Icon = New-UDIcon -Icon angry -Size lg -Regular
$CheckedIcon = New-UDIcon -Icon angry -Size lg
New-UDCheckBox -Icon $Icon -CheckedIcon $CheckedIcon -Style @{color = '#2196f3'}New-UDCheckBox -OnChange {
Show-UDToast -Title 'Checkbox' -Message $Body
}New-UDCheckBox -Label 'Demo' -LabelPlacement start
New-UDCheckBox -Label 'Demo' -LabelPlacement top
New-UDCheckBox -Label 'Demo' -LabelPlacement bottom
New-UDCheckBox -Label 'Demo' -LabelPlacement endNew-UDCheckbox -Id 'MyCheckbox'
New-UDButton -Text 'Get Value' -OnClick {
Show-UDToast -Message (Get-UDElement -Id 'MyCheckbox').checked
}$Drawer = New-UDDrawer -Children {
New-UDList -Children {
New-UDListItem -Label "Home"
New-UDListItem -Label "Getting Started" -Children {
New-UDListItem -Label "Installation" -OnClick {}
New-UDListItem -Label "Usage" -OnClick {}
New-UDListItem -Label "FAQs" -OnClick {}
New-UDListItem -Label "System Requirements" -OnClick {}
New-UDListItem -Label "Purchasing" -OnClick {}
}
}
}
New-UDAppBar -Position relative -Children { New-UDElement -Tag 'div' -Content { "Title" } } -Drawer $DrawerNew-UDAppBar -Children { "Hello" } -FooterNew-UDAppBar -Position fixed -Children { New-UDElement -Tag 'div' -Content { "Title" } }
New-UDElement -Tag 'div' -Content {
} -Attributes @{
style = @{
height = "10000px"
}
}New-UDSlider -Value 1New-UDSlider -Min 10 -Max 1000New-UDSlider -DisabledNew-UDSlider -Min 10 -Max 1000 -Step 100New-UDSlider -MarksNew-UDSlider -Value @(1, 10)New-UDSlider -OnChange {
Show-UDToast -Message $Body
Set-TestData $Body
} "UniversalDashboard": {
"AssetsFolder": "%ProgramData%\\PowerShellUniversal\\Dashboard",
},New-UDProgress -PercentComplete 75New-UDTypography -Text 'My Text' -Style @{ color = 'blue' }
New-UDTypography -Text 'Secondar' -Sx @{
color = 'text.secondary'
} New-UDChip -Label 'Basic'New-UDChip -Label 'Basic' -Icon (New-UDIcon -Icon 'user')New-UDChip -Label 'OnClick' -OnClick {
Show-UDToast -Message 'Hello!'
}New-UDChip -Label 'OnDelete' -OnClick {
Show-UDToast -Message 'Goodbye!'
}New-UDPaper -Square -Content {}New-UDPaper -Content { } -Style @{
backgroundColor = 'red'
}New-UDFloatingActionButton -Icon (New-UDIcon -Icon user) -OnClick {
Show-UDToast -Message "Hello!"
}$Layout = '{"lg":[{"w":7,"h":7,"x":5,"y":0,"i":"grid-element-Paper1","moved":false,"static":false},{"w":7,"h":5,"x":5,"y":7,"i":"grid-element-Paper2","moved":false,"static":false},{"w":1,"h":1,"x":0,"y":0,"i":"grid-element-Paper3","moved":false,"static":false},{"w":1,"h":1,"x":0,"y":1,"i":"grid-element-Paper4","moved":false,"static":false},{"w":1,"h":1,"x":0,"y":2,"i":"grid-element-Paper5","moved":false,"static":false},{"w":1,"h":1,"x":0,"y":3,"i":"grid-element-Paper6","moved":false,"static":false},{"w":1,"h":1,"x":0,"y":4,"i":"grid-element-Paper7","moved":false,"static":false},{"w":1,"h":1,"x":0,"y":5,"i":"grid-element-Paper8","moved":false,"static":false},{"w":1,"h":1,"x":0,"y":6,"i":"grid-element-Paper9","moved":false,"static":false},{"w":1,"h":1,"x":0,"y":7,"i":"grid-element-Paper10","moved":false,"static":false}]}'
New-UDGridLayout -Content { 1..10 | ForEach-Object { New-UDPaper -Id "Paper$" -Content { New-UDTypography -Text $ } -Elevation 5 } } -Layout $LayoutNew-UDGridLayout -Content { 1..10 | ForEach-Object { New-UDPaper -Id "Paper$" -Content { New-UDTypography -Text $ } -Elevation 5 } } -Draggable -Resizable -PersistNew-UDDashboard -Title 'My New Dashboard' -Content {
New-UDTypography -Text 'Hello!'
}New-UDDashboard -Title "Hello, World!" -Content {
New-UDDynamic -Id 'date' -Content {
New-UDTypography -Text "$(Get-Date)"
}
New-UDButton -Text 'Reload Date' -OnClick { Sync-UDElement -Id 'date' }
}New-UDDatePickerNew-UDUpload -OnUpload {
Show-UDToast $Body
} -Text 'Upload'



New-UDDashboard -Title 'My New Dashboard' -Content {
New-UDTypography -Text 'Hello!'
}New-UDDashboard -Content {
} -Navigation (
New-UDList -Children {
New-UDListItem -Label "Home"
New-UDListItem -Label "Getting Started" -Children {
New-UDListItem -Label "Installation" -OnClick {}
New-UDListItem -Label "Usage" -OnClick {}
New-UDListItem -Label "FAQs" -OnClick {}
New-UDListItem -Label "System Requirements" -OnClick {}
New-UDListItem -Label "Purchasing" -OnClick {}
}
}
) -NavigationLayout permanentNew-UDPage -Content {
New-UDTextbox
}$Pages = @()
$Pages += New-UDPage -Name 'My Home Page' -Content {}
$Pages += New-UDPage -Name 'Diagnostics' -Content {}
New-UDDashboard -Pages $Pages -Title 'Dashboard'$DebugPreference = 'Continue'New-UDDashboard -Title 'Dashboard' -Content {
} -Menu {
New-UDMenuItem -Text 'Profile' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text 'Welcome to your profile!'
}
}
}function Get-User {
1..100 | ForEach-Object {
[PSCustomObject]@{
UserName = "User$_"
First = "Bill"
Last = $_
Avatar = (Get-ChildItem "$Repository\Avatars" | Get-Random).Name
}
}
}
function New-UDPeoplePicker {
$Session:Users = [System.Collections.Generic.List[object]]::new()
New-UDAutocomplete -OnLoadOptions {
Get-User | Where-Object { $_.UserName -like "*$UserName*" } | Select-Object -First 5 -ExpandProperty 'UserName' | ConvertTo-Json
} -OnChange {
$Session:Users.Add((Get-User | Where-Object { $_.UserName -eq $EventData })) | Out-Null
Sync-UDElement -Id 'users'
}
New-UDDynamic -Id 'users' -Content {
New-UDList -Children {
$Session:Users | ForEach-Object {
New-UDListItem -Label $_.UserName -SubTitle "$($_.First) $($_.Last)" -AvatarType 'Avatar' -SecondaryAction {
$UserName = $_.UserName
New-UDIconButton -Icon (New-UDIcon -Icon 'Trash') -OnClick {
$RemoveUser = $Session:Users | Where-Object { $_.UserName -eq $UserName }
$Session:Users.Remove($RemoveUser)
Sync-UDElement -Id 'users'
}
} -Source "/avatars/$($_.Avatar)"
}
}
}
}
New-UDDashboard -Title 'PowerShell Universal' -Content {
New-UDPeoplePicker
}{
data: "base64 encoded string of data",
name: "file name of the file uploaded",
type: "file type as determined by the browser"
}public class Upload
{
public string Name { get; set; }
public string FileName { get; set; }
public DateTime TimeStamp { get; set; }
public string ContentType { get; set; }
public string Type => ContentType;
}New-UDForm -Content {
New-UDUpload -Id 'myFile' -Text 'Upload File'
} -OnSubmit {
Show-UDToast $Body
}New-UDUpload -Text 'Upload Image' -OnUpload {
$Data = $Body | ConvertFrom-Json
$bytes = [System.Convert]::FromBase64String($Data.Data)
[System.IO.File]::WriteAllBytes("$env:temp\$($Data.Name)", $bytes)
}Install-Module Universal
Install-PSUServerInstall-Module Universal
Install-PSUServer -AddToPath
Start-PSUServer -Port 5000wget https://imsreleases.blob.core.windows.net/universal/production/2.4.0/Universal.linux-arm.2.4.0.zip
unzip Universal.linux-arm.2.3.2.zip -d ./PSU
chmod +x ./PSU/Universal.Server
./PSU/Universal.Server
Install-Module Universal
Install-PSUServerNew-UDEditor cmdlet.
New-UDSkeleton
New-UDSkeleton -Animation disabled
New-UDSkeleton -Animation waveNew-UDBackdrop -Id 'backdrop' -Content {
New-UDTypography -Text "Loading..." -Variant h2
} -Open -OnClick {
Set-UDElement -Id 'backdrop' -Properties @{
open = $false
}
}
New-PSUEndpoint -Url '/endpoint' -Method 'GET' -Endpoint {
"Hello, world!"
} -AuthenticationInvoke-RestMethod http://localhost:5000/auth -Headers @{ Authorization = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiQWRtaW4iLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9oYXNoIjoiMWUyY2IzNzAtMmMyNS00ZDU5LTk4YzgtMzc5MTFjMDAyZmI5Iiwic3ViIjoiUG93ZXJTaGVsbFVuaXZlcnNhbCIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6IkFkbWluaXN0cmF0b3IiLCJuYmYiOjE2MDU2NjEyNTUsImV4cCI6MTYzNzM2NzI1OCwiaXNzIjoiSXJvbm1hblNvZnR3YXJlIiwiYXVkIjoiUG" }Invoke-RestMethod http://localhost:5000/auth -UseDefaultCredentialsInvoke-WebRequest http://localhost:5000/api/v1/signin -Body (@{
UserName = "Admin"
Password = "Any"
} | ConvertTo-Json) -ContentType 'application/json' -SessionVariable mySession -Method POST Invoke-WebRequest http://localhost:5000/auth -WebSession $mySessionGet-ComputerInfoPS C:\Users\adamr> Invoke-RestMethod http://localhost:5000/hello-world
WindowsBuildLabEx : 22000.1.amd64fre.co_release.210604-1628
WindowsCurrentVersion : 6.3
WindowsEditionId : Professional
WindowsInstallationType : Client
WindowsInstallDateFromRegistry : 8/6/2021 4:05:12 PM
WindowsProductId : 00330-52452-93139-AAOEM
WindowsProductName : Windows 10 Pro
WindowsRegisteredOrganization :Read-Host "What should I say?"
1..100 | ForEach-Object {
Write-Progress -PercentComplete $_ -Activity "Processing..."
}
Get-ServiceNew-UDDashboard -Title "Hello, World!" -Content {
New-UDButton -Text "Click Me" -OnClick {
Show-UDToast -Message 'Success!!'
}
}param($UserName)
$UserNameNew-PSUSchedule -Script "MyScript.ps1" -Cron '* * * * *' -UserName 'adam'New-PSUSchedule -Script "MyScript.ps1" -Cron '* * * * *' -Environment '7.1'New-PSUSchedule -Script "MyScript.ps1" -Cron '* * * * *' -Credential 'MyUser'New-PSUSchedule -Script "MyScript.ps1" -Cron '* * * * *' -Computer 'PSUNODE1'New-PSUSchedule -Script "MyScript.ps1" -Cron '* * * * *' -Condition {
$ENV:Slot -eq 'production'
}New-UDEditorNew-UDEditor -OnChange {
Show-UDToast $EventData
}New-UDEditor -OnChange {
Show-UDToast $EventData
} -Format 'html'New-UDEditor -Data $DataNew-UDEditor -PublishedFolder 'MyImages'New-UDIcon -Icon 'NetworkWired'Find-UDIcon UserNew-UDIcon -Icon 'AddressBook' New-UDIcon -Icon 'AddressBook' -Size 'sm'
New-UDIcon -Icon 'AddressBook' -Size 'lg'
New-UDIcon -Icon 'AddressBook' -Size '5x'
New-UDIcon -Icon 'AddressBook' -Size '10x'New-UDIcon -Icon 'AddressBook' -Size '5x' -Rotation 90New-UDIcon -Icon 'AddressBook' -Size '5x' -BorderNew-UDIcon -Icon 'AddressBook' -Size '5x' -Style @{
backgroundColor = "red"
}New-UDTextbox -Id 'txtIconSearch' -Label 'Search'
New-UDButton -Text 'Search' -OnClick {
Sync-UDElement -Id 'icons'
}
New-UDElement -tag 'p' -Content {}
New-UDDynamic -Id 'icons' -Content {
$IconSearch = (Get-UDElement -Id 'txtIconSearch').value
if ($null -ne $IconSearch -and $IconSearch -ne '')
{
$Icons =$Icons = Find-UDIcon -Name $IconSearch
}
foreach($icon in $icons) {
try{
New-UDChip -Label $icon -Icon (New-UDIcon -Icon $icon)
}
catch{
New-UDChip -Label "$icon Unknown"
}
}
} https://github.com/FortAwesome/Font-Awesome/blob/6.x/metadata/icons.jsonInstall-Module Universal.Icons.TablerNew-UDButton -Icon (New-UDTablerIcon -Icon "Tb3DRotate")New-UDAutocomplete -Options @('Test', 'Test2', 'Test3', 'Test4')New-UDAutocomplete -OnLoadOptions {
@('Test', 'Test2', 'Test3', 'Test4') | Where-Object { $_ -like "*$Body*" } | ConvertTo-Json
}New-UDAutocomplete -OnLoadOptions {
@('Test', 'Test2', 'Test3', 'Test4') | Where-Object { $_ -like "*$Body*" } | ConvertTo-Json
} -OnChange {
Show-UDToast $Body
}New-UDAutocomplete -Options @("Test", "No", "Yes") -Icon (New-UDIcon -Icon 'Users') New-UDAutocomplete -Options @("Test", "No", "Yes") -onEnter {
Show-UDToast ((Get-UDElement -Id 'ac').value)
} -Id 'ac'New-UDAutocomplete -Options @(
New-UDAutoCompleteOption -Name 'Adam D' -Value '1'
New-UDAutoCompleteOption -Name 'Sarah F' -Value '2'
New-UDAutoCompleteOption -Name 'Tom S' -Value '3'
)New-UDButton -Text 'Basic' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
}
}New-UDButton -Text 'Full Screen' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
} -Footer {
New-UDButton -Text "Close" -OnClick { Hide-UDModal }
} -FullScreen
}New-UDButton -Text 'Full Width' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
} -FullWidth -MaxWidth 'md'
}New-UDButton -Text 'Persistent' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
} -Footer {
New-UDButton -Text "Close" -OnClick { Hide-UDModal }
} -Persistent
}New-UDButton -Text 'Basic' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
}
Start-Sleep 5
Hide-UDModal
}New-UDButton -Text 'Styling' -OnClick {
Show-UDModal -Content {
New-UDTypography -Text "Hello"
} -Style @{
backgroundColor = "red"
}
}New-UDSelect -Option {
New-UDSelectOption -Name 'One' -Value 1
New-UDSelectOption -Name 'Two' -Value 2
New-UDSelectOption -Name 'Three' -Value 3
}New-UDSelect -Option {
New-UDSelectGroup -Name 'Group One' -Option {
New-UDSelectOption -Name 'One' -Value 1
New-UDSelectOption -Name 'Two' -Value 2
New-UDSelectOption -Name 'Three' -Value 3
}
New-UDSelectGroup -Name 'Group Two' -Option {
New-UDSelectOption -Name 'Four' -Value 4
New-UDSelectOption -Name 'Five' -Value 5
New-UDSelectOption -Name 'Size' -Value 6
}
}New-UDSelect -Option {
New-UDSelectOption -Name 'One' -Value 1
New-UDSelectOption -Name 'Two' -Value 2
New-UDSelectOption -Name 'Three' -Value 3
} -OnChange { Show-UDToast -Message $EventData[0] }New-UDSelect -Multiple -Option {
New-UDSelectOption -Name 'One' -Value 1
New-UDSelectOption -Name 'Two' -Value 2
New-UDSelectOption -Name 'Three' -Value 3
} -OnChange {
Show-UDToast -Message (ConvertTo-json -InputObject $EventData)
} New-UDSelect -Option {
New-UDSelectOption -Name 'One' -Value 1
New-UDSelectOption -Name 'Two' -Value 2
New-UDSelectOption -Name 'Three' -Value 3
} -Id 'select' -DefaultValue 2
New-UDButton -Text 'OnBoard' -OnClick {
$Element = Get-UDElement -Id 'select'
if ($Element.Value)
{
Show-UDToast -Message $Element.Value
}
else
{
Show-UDToast -Message $Element.DefaultValue
}
}New-UDCard -Title 'Simple Card' -Content {
"This is some content"
}$Header = New-UDCardHeader -Avatar (New-UDAvatar -Content { "R" } -Sx @{ backgroundColor = "#f44336" }) -Action (New-UDIconButton -Icon (New-UDIcon -Icon 'EllipsisVertical')) -Title 'Shrimp and Chorizo Paella' -SubHeader 'September 14, 2016';
$Media = New-UDCardMedia -Image 'https://mui.com/static/images/cards/paella.jpg'
$Body = New-UDCardBody -Content {
New-UDTypography -Text ' This impressive paella is a perfect party dish and a fun meal to cook together with your guests. Add 1 cup of frozen peas along with the mussels, if you like.' -Sx @{
color = 'text.secondary'
} -Variant body2
}
$Footer = New-UDCardFooter -Content {
New-UDIconButton -Icon (New-UDIcon -Icon 'Heart')
New-UDIconButton -Icon (New-UDIcon -Icon 'ShareAlt')
}
$Expand = New-UDCardExpand -Content {
$Description = @"
Heat oil in a (14- to 16-inch) paella pan or a large, deep skillet over
medium-high heat. Add chicken, shrimp and chorizo, and cook, stirring
occasionally until lightly browned, 6 to 8 minutes. Transfer shrimp to a
large plate and set aside, leaving chicken and chorizo in the pan. Add
pimentón, bay leaves, garlic, tomatoes, onion, salt and pepper, and cook,
stirring often until thickened and fragrant, about 10 minutes. Add
saffron broth and remaining 4 1/2 cups chicken broth; bring to a boil.
New-UDTypography -Text $Description
}
New-UDCard -Header $Header -Media $Media -Body $Body -Footer $Footer -Expand $Expand -Sx @{
maxWidth = 345
border = '2px solid #f0f2f5'
}New-UDDynamic -Id 'dynamic_01' -Content {
New-UDTypography -Text "This is an $($ArgumentList[0])
an $($ArgumentList[1]) in a UDDynamic"
} -ArgumentList @('example of', 'arguments list') New-UDDynamic -Id 'date' -Content {
New-UDTypography -Text "$(Get-Date)" -Variant h3
New-UDTypography -Text "$(Get-Random)" -Variant h3
} -AutoRefresh -AutoRefreshInterval 1 New-UDDynamic -Content {
Start-Sleep -Seconds 3
New-UDTypography -Text "Done!"
} -LoadingComponent {
New-UDProgress -Circular
}New-PSUEnvironment -Name 'Env' -Path 'powershell.exe' -PersistentRunspaceNew-PSUDashboard -Name 'Dashboard' -BaseUrl '/' -Framework "UniversalDashboard:Latest" -Authenticated -GrantAppTokenNew-UDDashboard -Title "Hello, World!" -Content {
New-UDButton -Text 'Job' -OnClick {
Invoke-UAScript -Name 'Test.ps1'
}
}New-PSUDashboard -Name 'Dashboard' -BaseUrl '/' -Framework "UniversalDashboard:Latest" -Authenticated -DisableErrorToastNew-UDDashboard -Title "Hello, World!" -Content {
New-UDButton -Text 'Job' -OnClick {
throw "Exception
}
} New-PSUDashboard -Name 'Dashboard' -BaseUrl '/' -Framework "UniversalDashboard:Latest" -DisableStartupLoggingNew-UDMenu -Content {
New-UDMenuItem -Text 'Item 1'
New-UDMenuItem -Text 'Item 1'
New-UDMenuItem -Text 'Item 1'
}New-UDMenu -Content {
New-UDMenuItem -Text 'Item 1'
New-UDMenuItem -Text 'Item 1'
New-UDMenuItem -Text 'Item 1'
} -Variant outlinedNew-UDMenu -Content {
New-UDMenuItem -Text 'Item 1' -Value 'item1'
New-UDMenuItem -Text 'Item 1' -Value 'item2'
New-UDMenuItem -Text 'Item 1' -Value 'item3'
}New-UDMenu -Text 'Click Me' -OnChange {
Show-UDToast $EventData
} -Children {
New-UDMenuItem -Text 'Test'
New-UDMenuItem -Text 'Test2'
New-UDMenuItem -Text 'Test3'
}New-UDCodeEditor -Height '500' -Language 'powershell'New-UDCodeEditor -Height '500' -Language 'powershell' -Code '#Hello, world!'New-UDCodeEditor -Height '500' -Language 'powershell' -Code '#Hello, world!' -Id 'editor'
New-UDButton -Text 'Get Code' -OnClick {
Show-UDToast -Message (Get-UDElement -id 'editor').Code
}New-UDCodeEditor -Height '500' -Language 'powershell' -Code '#Hello, world!' -Id 'editor'
New-UDButton -Text 'Get Code' -OnClick {
Set-UDElement -Id 'editor' -Properties @{
code = "# Hello!"
}
}New-UDCodeEditor -Language powershell -Height 100 -Options @{ fontSize = 10 }New-UDRadioGroup -Label "Day" -Content {
New-UDRadio -Label Monday -Value 'monday'
New-UDRadio -Label Tuesday -Value 'tuesday'
New-UDRadio -Label Wednesday -Value 'wednesday'
New-UDRadio -Label Thursday -Value 'thursday'
New-UDRadio -Label Friday -Value 'friday'
New-UDRadio -Label Saturday -Value 'saturday'
New-UDRadio -Label Sunday -Value 'sunday'
}New-UDRadioGroup -Label "Day" -Content {
New-UDRadio -Label Monday -Value 'monday'
New-UDRadio -Label Tuesday -Value 'tuesday'
New-UDRadio -Label Wednesday -Value 'wednesday'
New-UDRadio -Label Thursday -Value 'thursday'
New-UDRadio -Label Friday -Value 'friday'
New-UDRadio -Label Saturday -Value 'saturday'
New-UDRadio -Label Sunday -Value 'sunday'
} -OnChange { Show-UDToast -Message $Body }
}New-UDRadioGroup -Label "Day" -Content {
New-UDRadio -Label Monday -Value 'monday'
New-UDRadio -Label Tuesday -Value 'tuesday'
New-UDRadio -Label Wednesday -Value 'wednesday'
New-UDRadio -Label Thursday -Value 'thursday'
New-UDRadio -Label Friday -Value 'friday'
New-UDRadio -Label Saturday -Value 'saturday'
New-UDRadio -Label Sunday -Value 'sunday'
} -Value 'sunday'New-UDRadioGroup -Label "Day" -Content {
New-UDRow -Columns {
New-UDColumn -LargeSize 1 -Content {
New-UDRadio -Label Monday -Value 'monday'
}
New-UDColumn -LargeSize 1 -Content {
New-UDRadio -Label Sunday -Value 'sunday'
}
}
}New-UDDatePicker -OnChange {
Show-UDToast -Message $body
}New-UDDatePicker -Variant staticNew-UDDatePicker -Locale frNew-UDDatePicker -Minimum ((Get-Date).AddDays(-15)) -Maximum ((Get-Date).AddDays(15))New-UDTimeline -Children {
New-UDTimelineItem -Content {
'Breakfast'
} -OppositeContent {
'7:45 AM'
}
New-UDTimelineItem -Content {
'Welcome Message'
} -OppositeContent {
'9:00 AM'
}
New-UDTimelineItem -Content {
'State of the Shell'
} -OppositeContent {
'9:30 AM'
}
New-UDTimelineItem -Content {
'General Session'
} -OppositeContent {
'11:00 AM'
}
}New-UDGrid -Container -Content {
New-UDGrid -Item -ExtraSmallSize 12 -Content {
New-UDPaper -Content { "xs-12" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 6 -Content {
New-UDPaper -Content { "xs-6" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 6 -Content {
New-UDPaper -Content { "xs-6" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDPaper -Content { "xs-3" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDPaper -Content { "xs-3" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDPaper -Content { "xs-3" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDPaper -Content { "xs-3" } -Elevation 2
}
}New-UDTransition -Id 'test' -Content {
New-UDCard -Text "Hey"
} -In -Fade -Timeout 1000
New-UDSwitch -OnChange {
Set-UDElement -Id 'test' -Properties @{
in = $EventData -eq 'True'
}
} -Checked $true





New-UDElement -Tag 'div' -Content { 'Hello' }New-UDElement -Tag 'ul' -Content {
New-UDElement -Tag 'li' -Content { 'First' }
New-UDElement -Tag 'li' -Content { 'Second' }
New-UDElement -Tag 'li' -Content { 'Third' }
}New-UDElement -Tag 'div' -Content { 'Hello' } -Attributes @{
style = @{
color = 'red'
}
}New-UDElement -Tag div -Content {
New-UDIcon -Icon "user"
} -Attributes @{
onClick = {
Show-UDToast "Nice!"
}
}New-UDElement -Tag 'div' -Endpoint {
Get-Date
} -AutoRefresh -RefreshInterval 1New-UDElement -Tag 'div' -Id 'myElement' -Content { }
New-UDButton -Text 'Click Me' -OnClick {
Set-UDElement -Id 'myElement' -Content { Get-Date }
} New-UDElement -Tag 'div' -Id 'myElement' -Content { }
New-UDButton -Text 'Click Me' -OnClick {
Set-UDElement -Id 'myElement' -Content { Get-Date } -Properties @{ Attributes = @{ style = @{ color = "red" } } }
}New-UDElement -Tag 'ul' -Content {
} -Id 'myList'
New-UDButton -Text 'Click Me' -OnClick {
Add-UDElement -ParentId 'myList' -Content {
New-UDElement -Tag 'li' -Content { Get-Date }
}
}New-UDElement -Tag 'ul' -Content {
New-UDElement -Tag 'li' -Content { 'First' }
New-UDElement -Tag 'li' -Content { 'Second' }
New-UDElement -Tag 'li' -Content { 'Third' }
} -Id 'myList'
New-UDButton -Text 'Click Me' -OnClick {
Clear-UDElement -Id 'myList'
}New-UDElement -Tag 'div' -Endpoint {
Get-Date
} -Id 'myDiv'
New-UDButton -Text 'Click Me' -OnClick {
Sync-UDElement -Id 'myDiv'
}New-UDElement -Tag 'div' -Endpoint {
Get-Date
} -Id 'myDiv'
New-UDButton -Text 'Click Me' -OnClick {
Remove-UDElement -Id 'myDiv'
}New-UDTimeline -Children {
New-UDTimelineItem -Content {
'Breakfast'
} -OppositeContent {
'7:45 AM'
}
New-UDTimelineItem -Content {
'Welcome Message'
} -OppositeContent {
'9:00 AM'
}
New-UDTimelineItem -Content {
'State of the Shell'
} -OppositeContent {
'9:30 AM'
}
New-UDTimelineItem -Content {
'General Session'
} -OppositeContent {
'11:00 AM'
}
} -Position alternateNew-UDDashboard -Title 'PowerShell Universal' -Content {
New-UDTimeline -Children {
New-UDTimelineItem -Content {
'Breakfast'
} -OppositeContent {
'7:45 AM'
} -Color 'error'
New-UDTimelineItem -Content {
'Welcome Message'
} -OppositeContent {
'9:00 AM'
} -Color 'info'
New-UDTimelineItem -Content {
'State of the Shell'
} -OppositeContent {
'9:30 AM'
} -Color 'success'
New-UDTimelineItem -Content {
'General Session'
} -OppositeContent {
'11:00 AM'
} -Color 'grey'
} -Position alternate
}New-UDTimeline -Children {
New-UDTimelineItem -Content {
'Breakfast'
} -OppositeContent {
'7:45 AM'
} -Icon (New-UDIcon -Icon Microsoft)
New-UDTimelineItem -Content {
'Welcome Message'
} -OppositeContent {
'9:00 AM'
} -Icon (New-UDIcon -Icon Apple)
New-UDTimelineItem -Content {
'State of the Shell'
} -OppositeContent {
'9:30 AM'
} -Icon (New-UDIcon -Icon NetworkWired)
New-UDTimelineItem -Content {
'General Session'
} -OppositeContent {
'11:00 AM'
} -Icon (New-UDIcon -Icon User)
} -Position alternateStop
PowerShell scripts to execute within PowerShell Universal.
Installation instructions for PowerShell Universal.

@{
Name = "username"
Roles = @()
}@{
UserName = 'username'
RemoteIpAddress = ''
LocalPort = ''
RemotePort = ''
}public class GitStatus
{
public long Id { get; set; }
public string CommitId { get; set; }
public DateTime Timestamp { get; set; }
public TimeSpan SyncTime { get; set; }
public int Changes { get; set; }
public string Location { get; set; }
public string Remote { get; set; }
public GitStatusResult Result { get; set; }
public string ResultMessage { get; set; }
public string ComputerName { get; set; }
}New-PSUTrigger -Name 'Trigger' -EventType JobStarted -TriggerScript Script.ps1New-PSUTrigger -Name 'Trigger' -EventType DashboardStopped -TriggerScript Script.ps1 -Dashboard 'Dashboard'param($Job)
$Jobparam($Dashboard)
$DashboardNew-PSUTrigger -Condition {
$Env:Environment -eq 'production'
}New-PSUEndpoint -Url "/error" -Endpoint {
throw "Uh oh!"
} -ErrorAction stop
New-PSUEndpoint -Url /error2 -Endpoint {
Write-Error "Whoa!"
} -ErrorAction StopPS C:\Users\adamr> invoke-restmethod http://localhost:5000/error2
invoke-restmethod : The remote server returned an error: (500) Internal Server Error.
At line:1 char:1
+ invoke-restmethod http://localhost:5000/error2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], Web
Exception
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommandPS C:\Users\adamr\Desktop> invoke-restmethod http://localhost:5000/error
Invoke-RestMethod: Uh oh!
at , : line 2
at , : line 1
PS C:\Users\adamr\Desktop> invoke-restmethod http://localhost:5000/error2
Invoke-RestMethod: Whoa
at , : line 2
at , : line 1PS C:\Users\adamr> try { invoke-restmethod http://localhost:5000/error2 } catch { [System.IO.StreamReader]::new($_.Exception.Response.GetResponseStream()).ReadToEnd()}
Whoa!
at <ScriptBlock>, <No file>: line 2
at <ScriptBlock>, <No file>: line 1New-PSUEndpoint -Url /broken -Endpoint {
New-PSUApiResponse -StatusCode 404 -Body 'Failed!'
}PS C:\Users\adamr\Desktop> invoke-restmethod http://localhost:5000/broken
Invoke-RestMethod: Failed!PS C:\Users\adamr> invoke-restmethod http://localhost:5000/broken
invoke-restmethod : The remote server returned an error: (404) Not Found.
At line:1 char:1
+ invoke-restmethod http://localhost:5000/broken
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], Web
Exception
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommandNew-PSUEndpoint -Url /user/:name -Endpoint {
if ($Name -eq 'User')
{
@{ UserName = "Adam" }
}
else
{
New-PSUApiResponse -StatusCode 404 -Body 'Unknown user!'
}
}New-UDDynamic -Id 'spacingGrid' -Content {
$Spacing = (Get-UDElement -Id 'spacingSelect').value
New-UDGrid -Spacing $Spacing -Container -Content {
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDPaper -Content { "xs-3" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDPaper -Content { "xs-3" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDPaper -Content { "xs-3" } -Elevation 2
}
New-UDGrid -Item -ExtraSmallSize 3 -Content {
New-UDPaper -Content { "xs-3" } -Elevation 2
}
}
}
New-UDSelect -Id 'spacingSelect' -Label Spacing -Option {
for($i = 0; $i -lt 10; $i++)
{
New-UDSelectOption -Name $i -Value $i
}
} -OnChange { Sync-UDElement -Id 'spacingGrid' } -DefaultValue 3New-UDRow -Columns {
New-UDColumn -SmallSize 12 -Content {
New-UDPaper -Content { "xs-12" } -Elevation 2
}
New-UDColumn -SmallSize 12 -Content {
New-UDPaper -Content { "xs-12" } -Elevation 2
}
}New-UDTransition -Id 'test' -Content {
New-UDCard -Text "Hey"
} -In -Collapse -CollapseHeight 100 -Timeout 1000
New-UDSwitch -OnChange {
Set-UDElement -Id 'test' -Properties @{
in = $EventData -eq 'True'
}
} -Checked $trueNew-UDTransition -Id 'test' -Content {
New-UDCard -Text "Hey"
} -In -Fade -Timeout 1000
New-UDSwitch -OnChange {
Set-UDElement -Id 'test' -Properties @{
in = $EventData -eq 'True'
}
} -Checked $trueNew-UDTransition -Id 'test' -Content {
New-UDCard -Text "Hey"
} -In -Slide -SlideDirection 'left' -Timeout 1000
New-UDSwitch -OnChange {
Set-UDElement -Id 'test' -Properties @{
in = $EventData -eq 'True'
}
} -Checked $trueNew-UDTransition -Id 'test' -Content {
New-UDCard -Text "Hey"
} -In -Grow -Timeout 1000
New-UDSwitch -OnChange {
Set-UDElement -Id 'test' -Properties @{
in = $EventData -eq 'True'
}
} -Checked $trueNew-UDTransition -Id 'test' -Content {
New-UDCard -Text "Hey"
} -In -Zoom -Timeout 1000
New-UDSwitch -OnChange {
Set-UDElement -Id 'test' -Properties @{
in = $EventData -eq 'True'
}
} -Checked $trueNew-UDTextbox -Label 'Standard' -Placeholder 'Textbox'
New-UDTextbox -Label 'Disabled' -Placeholder 'Textbox' -Disabled
New-UDTextbox -Label 'Textbox' -Value 'With value'



















Start-Process msiexec.exe -ArgumentList "/I C:\Users\adamr\Downloads\PowerShellUniversal.3.5.1.msi /q /norestart /L*V `"C:\users\adamr\desktop\msi.log.txt`" STARTSERVICE=0" -Wait -NoNewWindowExpand-Archive -Path .\Universal.zip -DestinationPath .\Universal
Get-ChildItem .\Universal -Recurse | Unblock-File
Start-Process .\Universal\Universal.Server.exe wget https://imsreleases.blob.core.windows.net/universal/production/2.0.0/Universal.linux-x64.2.0.0.zip
sudo apt install unzip
unzip Universal.linux-x64.2.0.0.zip -d PSU
chmod +x ./PSU/Universal.Server
./PSU/Universal.ServerInstall-Module UniversalInstall-PSUServer -LatestVersionchoco install powershelluniversal
This document covers upgrading the PowerShell Universal application.
Jobs are the history of scripts that have been run.








New-PSUScript -Name Script.ps1 -Path Script.Ps1 -ConcurrentJobs 1param(
$Test,
[DateTime]$Time,
[int]$Number,
[PSCredential]$Credential,
[System.ConsoleColor]$Color
)<#
.SYNOPSIS
This is a script for pinging other computers.
.DESCRIPTION
This script can ping other computers.
.PARAMETER HostName
The host name or address to ping.
.LINK
https://www.ironmansoftware.com
#>
param($HostName)
Test-NetConnection $HostNameparam($Test)
$Testparam(
[String]$Textbox,
$Textbox2
)param([String[]]$Array)param([DateTime]$DateTime)param([Bool]$Switch)param([Int]$Number)param([Switch]$Switch)param([System.DayOfWeek]$DayOfWeek)param(
[PSCredential]$Credential
)param(
[File]$File
)[Text.Encoding]::UTF8.GetString($File.Content)param(
[ComponentModel.DisplayName("My Script")]
$MyScript
)param(
[Parameter(HelpMessage = "Class you want to enroll in")]
[string]$Class
)param(
[Parameter(Mandatory)]
$RequiredParameter
)
$RequiredParameterparam(
$Parameter = "Hello, World",
[DateTime]$ExecutionTime = Get-Date
)
$Parameter
$ExecutionTimeparam($MyParameter)
$MyParameterInvoke-PSUScript -Name 'Script.ps1' -MyParameter "Hello"param(
[Parameter(ParameterSetName = 'Set1')]
$Parameter1,
[Parameter(ParameterSetName = 'Set2')]
$Parameter2
)New-UDTextbox -Label 'Password' -Type passwordNew-UDTextbox -Multiline -Rows 4 -RowsMax 10New-UDTextbox -Id 'txtExample'
New-UDButton -OnClick {
$Value = (Get-UDElement -Id 'txtExample').value
Show-UDToast -Message $Value
} -Text "Get textbox value"New-UDTextbox -Id 'txtExample' -Label 'Label' -Value 'Value'
New-UDButton -OnClick {
Set-UDElement -Id 'txtExample' -Properties @{
Value = "test123"
}
} -Text "Get textbox value"New-UDTextbox -Id "ServerGroups" -Icon (New-UDIcon -Icon 'server') -Value "This is my server"New-UDTextbox -Mask "+1 (000) 000-0000"New-UDTextbox -Mask "+1 (000) 000-0000" -UnmaskNew-UDTextbox -OnEnter {
Invoke-UDEndpoint -Id 'submit' -Session
}
New-UDButton -Id 'submit' -OnClick {
Show-UDToast -Message 'From Textbox'
}New-UDTextbox -OnBlur {
Show-UDToast "Blurred"
}New-UDTextbox -OnValidate {
if ($EventData.Length -lt 10)
{
New-UDValidationResult -ValidationError 'String needs to be longer than 10'
}
}
























Update-Module Universal
Import-Module Universal -PassThruUpdate-PSUServerGet-ChildItem -Recurse | Unblock-File$ENV:Plugins__0 = "SQL"$Env:Data__ConnectionString = "Data Source=ServerName; Initial Catalog=DatabaseName; User Id=UserName; Password=UserPassword;"









Invoke-PSUScript -Script 'Script1.ps1' -RequiredParameter 'Hello'Invoke-PSUScript -Script 'Script1.ps1' -RequiredParameter 'Hello' | Wait-PSUJobGet-PSUJobPipelineOutput -JobId 10$Job = Get-PSUScript -Name 'Script.ps1' | Get-PSUJob -OrderDirection Descending -First 1
Get-PSUJobPipelineOutput -Job $Job
Get-PSUJobOutput -Job $JobInvoke-PSUScript -Script 'Script1.ps1' -RequiredParameter 'Hello' | Tee-Object -Variable job | Wait-PSUJob
$Pipeline = Get-PSUJobPipelineOutput -Job $Job
$HostOutput = Get-PSUJobOutput -Job $Job
# Access the actual string returned by the job
# $HostOutput may be an array
$HostOutput.Data$Pipeline = Invoke-PSUScript -Script 'Script1.ps1' -RequiredParameter 'Hello' -WaitInvoke-PSUScript -Script 'Script.ps1' -IntegratedInvoke-RestMethod http://localhost:5000/api/v1/script/7 -Method POST -Body "" -Headers @{ Authorization = "Bearer appToken" } -ContentType 'application/json'$Parameters = @{
Uri = "http://localhost:5000/api/v1/script/path/PNP.ps1?Server=tester&Domain=test"
Method = "POST"
Headers = @{Authorization = "Bearer $Apptoken"}
ContentType = 'application/json'
Body = '{}'
}
Invoke-RestMethod @Parameters$JobContext = @{
Environment = "PowerShell 7"
} | ConvertTo-Json
Invoke-RestMethod http://localhost:5000/api/v1/script/7 -Method POST -Body $JobContext -Headers @{ Authorization = "Bearer appToken" } -ContentType 'application/json'$JobContext = @{
Credential = "MyUser"
} | ConvertTo-Json
Invoke-RestMethod http://localhost:5000/api/v1/script/7 -Method POST -Body $JobContext -Headers @{ Authorization = "Bearer appToken" } -ContentType 'application/json'Set-PSUSetting -ExperimentalFeature ([PowerShellUniversal.ExperimentalFeatures]::JobRunId)






















































Form component for Universal Dashboard
New-UDMap -Endpoint {
New-UDMapRasterLayer -TileServer 'https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'
} -Latitude 43.52107 -Longitude -114.31644 -Zoom 13 -Height '100vh'New-UDMap -Endpoint {
New-UDMapLayerControl -Content {
New-UDMapBaseLayer -Name 'Black and White' -Content {
New-UDMapRasterLayer -TileServer 'https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'
} -Checked
New-UDMapBaseLayer -Name 'Color' -Content {
New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
}
New-UDMapOverlay -Name 'Marker' -Content {
New-UDMapMarker -Latitude 51.505 -Longitude -0.09
} -Checked
New-UDMapOverlay -Name 'Marker 2' -Content {
New-UDMapMarker -Latitude 51.555 -Longitude -0.00
} -Checked
}
} -Latitude 51.505 -Longitude -0.09 -Zoom 13 -Height '100vh'New-UDMap -Endpoint {
New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
New-UDMapMarker -Latitude "51.100" -Longitude "-0.5"
} -Latitude 51.505 -Longitude -0.09 -Zoom 13 -Height '100vh'New-UDMap -Endpoint {
New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
New-UDMapMarker -Latitude "51.100" -Longitude "-0.5"
} -Latitude 51.505 -Longitude -0.09 -Zoom 13 -Height '100vh' -Icon (New-UDMapIcon -Url = "https://ironmansoftware.com/img/ps-logo.png")
}New-UDMapMarker -Latitude "51.$RandomLat" -Longitude "-0.$Random" -Popup (
New-UDMapPopup -Content {
New-UDAlert -Text "Hello"
} -MinWidth 200
)New-UDMap -Endpoint {
New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
New-UDMapHeatmapLayer -Points @(
@(-37.9019339833, 175.3879181167, "625"),
@(-37.90920365, 175.4053418167, "397"),
@(-37.9057407667, 175.39478875, "540"),
@(-37.9243174333, 175.4220341833, "112"),
@(-37.8992012333, 175.3666729333, "815"),
@(-37.9110874833, 175.4102195833, "360"),
@(-37.9027096, 175.3913196333, "591"),
@(-37.9011183833, 175.38410915, "655"),
@(-37.9234701333, 175.4155696333, "181"),
@(-37.90254175, 175.3926162167, "582"),
@(-37.92450575, 175.4246711167, "90"),
@(-37.9242924167, 175.4289432833, "47"),
@(-37.8986079833, 175.3685293333, "801")
)
} -Height '100vh'New-UDMap -Endpoint {
New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
New-UDMapMarkerClusterLayer -Id 'cluster-layer' -Markers @(
1..100 | ForEach-Object {
$Random = Get-Random -Minimum 0 -Maximum 100
$RandomLat = $Random + 400
New-UDMapMarker -Latitude "51.$RandomLat" -Longitude "-0.$Random"
}
)
} -Latitude 51.505 -Longitude -0.09 -Zoom 13 -Height '100vh'New-UDButton -Text 'Add Circle' -OnClick {
Add-UDElement -ParentId 'Feature-Group' -Content {
New-UDMapVectorLayer -Id 'Vectors' -Circle -Latitude 51.505 -Longitude -0.09 -Radius 500 -Color blue -FillColor blue -FillOpacity .5
}
}
New-UDButton -Text 'Remove Circle' -OnClick {
Remove-UDElement -Id 'Vectors'
}
New-UDButton -Text 'Add Marker' -OnClick {
Add-UDElement -ParentId 'Feature-Group' -Content {
New-UDMapMarker -Id 'marker' -Latitude 51.505 -Longitude -0.09 -Popup (
New-UDMapPopup -Content {
New-UDCard -Title "Test"
} -MaxWidth 600
)
}
}
New-UDButton -Text 'Remove Marker' -OnClick {
Remove-UDElement -Id 'marker'
}
New-UDButton -Text 'Add Layer' -OnClick {
Add-UDElement -ParentId 'layercontrol' -Content {
New-UDMapOverlay -Id 'MyNewLayer' -Name "MyNewLayer" -Content {
New-UDMapFeatureGroup -Id 'Feature-Group2' -Content {
1..100 | % {
New-UDMapVectorLayer -Id 'test' -Circle -Latitude "51.$_" -Longitude -0.09 -Radius 50 -Color red -FillColor blue -FillOpacity .5
}
}
} -Checked
}
}
New-UDButton -Text 'Remove Layer' -OnClick {
Remove-UDElement -Id 'MyNewLayer'
}
New-UDButton -Text 'Move' -OnClick {
Set-UDElement -Id 'map' -Attributes @{
latitude = 51.550
longitude = -0.09
zoom = 10
}
}
New-UDButton -Text "Add marker to cluster" -OnClick {
Add-UDElement -ParentId 'cluster-layer' -Content {
$Random = Get-Random -Minimum 0 -Maximum 100
$RandomLat = $Random + 400
New-UDMapMarker -Latitude "51.$RandomLat" -Longitude "-0.$Random"
}
}
New-UDButton -Text "Add points to heatmap" -OnClick {
Add-UDElement -ParentId 'heatmap' -Content {
@(
@(51.505, -0.09, "625"),
@(51.505234, -0.0945654, "625"),
@(51.50645, -0.098768, "625"),
@(51.5056575, -0.0945654, "625"),
@(51.505955, -0.095675, "625"),
@(51.505575, -0.09657, "625"),
@(51.505345, -0.099876, "625"),
@(51.505768, -0.0923432, "625"),
@(51.505567, -0.02349, "625"),
@(51.50545654, -0.092342, "625"),
@(51.5045645, -0.09342, "625")
)
}
}
New-UDButton -Text "Clear heatmap" -OnClick {
Clear-UDElement -Id 'heatmap'
}
New-UDMap -Id 'map' -Endpoint {
New-UDMapLayerControl -Id 'layercontrol' -Content {
New-UDMapBaseLayer -Name "Black and White" -Content {
New-UDMapRasterLayer -TileServer 'https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'
}
New-UDMapBaseLayer -Name "Mapnik" -Content {
New-UDMapRasterLayer -TileServer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
}
New-UDMapBaseLayer -Name "Bing" -Content {
New-UDMapRasterLayer -Bing -ApiKey 'asdf3rwf34afaw-sdfasdfa23feaw-23424dfsdfa' -Type Road
} -Checked
New-UDMapOverlay -Name "Markers" -Content {
New-UDMapFeatureGroup -Id 'Feature-Group' -Content {
New-UDMapMarker -Id 'marker' -Latitude 51.505 -Longitude -0.09
} -Popup (
New-UDMapPopup -Content {
New-UDCard -Title "Test123"
} -MaxWidth 600
)
} -Checked
New-UDMapOverlay -Name 'Vectors' -Content {
New-UDMapFeatureGroup -Id 'Vectors' -Content {
}
} -Checked
New-UDMapOverlay -Name "Heatmap" -Content {
New-UDMapHeatmapLayer -Id 'heatmap' -Points @()
} -Checked
New-UDMapOverlay -Name "Cluster" -Content {
New-UDMapMarkerClusterLayer -Id 'cluster-layer' -Markers @(
1..100 | ForEach-Object {
$Random = Get-Random -Minimum 0 -Maximum 100
$RandomLat = $Random + 400
New-UDMapMarker -Latitude "51.$RandomLat" -Longitude "-0.$Random"
}
)
} -Checked
}
} -Latitude 51.505 -Longitude -0.09 -Zoom 13 -Height '100vh' -AnimateNew-UDStepper -Steps {
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 1" }
New-UDTextbox -Id 'txtStep1' -Value $EventData.Context.txtStep1
} -Label "Step 1"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 2" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep2' -Value $EventData.Context.txtStep2
} -Label "Step 2"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 3" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep3' -Value $EventData.Context.txtStep3
} -Label "Step 3"
} -OnFinish {
New-UDTypography -Text 'Nice! You did it!' -Variant h3
New-UDElement -Tag 'div' -Id 'result' -Content {$Body}
}{
context: {
txtStep1: "value1",
txtStep2: "value2",
txtStep3: "value3"
},
currentStep: 0
}{
context: {
field1: "value1"
},
currentStep: 0
}New-UDStepper -Steps {
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 1" }
New-UDTextbox -Id 'txtStep1' -Value $EventData.Context.txtStep1
} -Label "Step 1"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 2" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep2' -Value $EventData.Context.txtStep2
} -Label "Step 2"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 3" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep3' -Value $EventData.Context.txtStep3
} -Label "Step 3"
} -OnFinish {
New-UDTypography -Text 'Nice! You did it!' -Variant h3
New-UDElement -Tag 'div' -Id 'result' -Content {$Body}
} -OnValidateStep {
$Context = $EventData
if ($Context.CurrentStep -eq 0 -and $Context.Context.txtStep1 -eq 'bad')
{
New-UDValidationResult
}
else
{
New-UDValidationResult -Valid
}
}New-UDStepper -Steps {
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 1" }
New-UDTextbox -Id 'txtStep1' -Value $EventData.Context.txtStep1
} -Label "Step 1"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 2" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep2' -Value $EventData.Context.txtStep2
} -Label "Step 2"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 3" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep3' -Value $EventData.Context.txtStep3
} -Label "Step 3"
} -OnFinish {
New-UDTypography -Text 'Nice! You did it!' -Variant h3
New-UDElement -Tag 'div' -Id 'result' -Content {$Body}
} -OnValidateStep {
$Context = $EventData
if ($Context.CurrentStep -eq 0 -and $Context.Context.txtStep1 -eq 'bad')
{
New-UDValidationResult
}
else
{
New-UDValidationResult -Valid -ActiveStep 2
}
}New-UDStepper -Steps {
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 1" }
New-UDTextbox -Id 'txtStep1' -Value $EventData.Context.txtStep1
} -Label "Step 1"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 2" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep2' -Value $EventData.Context.txtStep2
} -Label "Step 2"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 3" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep3' -Value $EventData.Context.txtStep3
} -Label "Step 3"
} -OnFinish {
New-UDTypography -Text 'Nice! You did it!' -Variant h3
New-UDElement -Tag 'div' -Id 'result' -Content {$Body}
} -OnValidateStep {
New-UDValidationResult -Valid -DisablePrevious
}New-UDStepper -Steps {
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 1" }
New-UDTextbox -Id 'txtStep1' -Value $EventData.Context.txtStep1
} -Label "Step 1"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 2" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep2' -Value $EventData.Context.txtStep2
} -Label "Step 2"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 3" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep3' -Value $EventData.Context.txtStep3
} -Label "Step 3"
} -OnFinish {
New-UDTypography -Text 'Nice! You did it!' -Variant h3
New-UDElement -Tag 'div' -Id 'result' -Content {$Body}
} -Orientation 'vertical'







$Pages = @()
$Pages += New-UDPage -Name 'Dashboard' -Content {
New-UDTypography -Text 'Dashboard'
}
New-UDDashboard -Title 'Pages' -Pages $Pages$Pages = @()
$Pages += New-UDPage -Name 'Dashboard One' -Content {
New-UDTypography -Text 'Dashboard Two'
}
$Pages += New-UDPage -Name 'Dashboard Two' -Content {
New-UDTypography -Text 'Dashboard Two'
}
New-UDDashboard -Title 'Pages' -Pages $Pages$UDScriptRoot = $PSScriptRoot
$Pages = @()
$Pages += New-UDPage -Name 'Dashboard One' -Content {
. "$UDScriptRoot\db1.ps1"
}
$Pages += New-UDPage -Name 'Dashboard Two' -Content {
. "$UDScriptRoot\db2.ps1"
}
New-UDDashboard -Title 'Pages' -Pages $Pages$Pages = @()
$Pages += New-UDPage -Name 'Dashboard' -Url '/db' -Content {
New-UDTypography -Text 'Dashboard'
}
New-UDDashboard -Title 'Pages' -Pages $Pages$Pages = @()
$Pages += New-UDPage -Name 'Dashboard' -Url '/db/:user' -Content {
New-UDTypography -Text 'Dashboard for user: $User'
}
New-UDDashboard -Title 'Pages' -Pages $Pages$Pages = @()
$Pages += New-UDPage -Name 'Administrators' -Content {
New-UDTypography -Text 'Dashboard for user: $User'
} -Role 'Administrator'
$Pages += New-UDPage -Name 'Operators' -Content {
New-UDTypography -Text 'Dashboard for user: $User'
} -Role 'Operator'
New-UDDashboard -Title 'Pages' -Pages $PagesNew-UDPage -HeaderPosition fixed -Content {
New-UDElement -tag div -Attributes @{
style = @{
height = '150vh'
}
}
}New-UDPage -Name 'Home' -Content {
} -HeaderColor 'black' -HeaderBackgroundColor 'white'$Navigation = @(
New-UDListItem -Label "Home"
New-UDListItem -Label "Getting Started" -Children {
New-UDListItem -Label "Installation" -Href '/Installation'
New-UDListItem -Label "Usage" -Href '/Usage'
New-UDListItem -Label "FAQs" -Href '/faqs'
New-UDListItem -Label "System Requirements" -Href'/requirements'
New-UDListItem -Label "Purchasing" -Href '/purchasing'
}
)
$Pages = @()
$Pages += New-UDPage -Name 'Installation' -Content {
New-UDTypography -Text "Installation"
}
$Pages += New-UDPage -Name 'Usage' -Content {
New-UDTypography -Text "Usage"
}
New-UDDashboard -Title "Hello, World!" -Pages $Pages -NavigationLayout permanent -Navigation $Navigation$Navigation = {
New-UDListItem -Label "Home - $(Get-Date)"
New-UDListItem -Label "Getting Started" -Children {
New-UDListItem -Label "Installation" -Href '/installation'
New-UDListItem -Label "Usage" -Href '/usage'
New-UDListItem -Label "FAQs" -Href '/faqs'
New-UDListItem -Label "System Requirements" -Href'/requirements'
New-UDListItem -Label "Purchasing" -Href '/purchasing'
}
}
$Pages = @()
$Pages += New-UDPage -Name 'Test' -Content {
New-UDTypography -Text "Hello"
} -NavigationLayout permanent -LoadNavigation $Navigation
$Pages += New-UDPage -Name 'Test2' -Content {
New-UDTypography -Text "Hello"
} -NavigationLayout permanent -LoadNavigation $Navigation
New-UDDashboard -Title "Hello, World!" -Pages $Pages$Pages = @()
$Pages += New-UDPage -Name 'Test' -Content {
New-UDTypography -Text "Hello"
} -NavigationLayout permanent
$Pages += New-UDPage -Name 'Test2' -Content {
New-UDTypography -Text "Hello"
} -NavigationLayout permanent
New-UDDashboard -Title "Hello, World!" -Pages $Pages$Pages = @()
$Pages += New-UDPage -Name 'Test' -Content {
New-UDTypography -Text "Hello"
} -NavigationLayout temporary
$Pages += New-UDPage -Name 'Test2' -Content {
New-UDTypography -Text "Hello"
} -NavigationLayout temporary
New-UDDashboard -Title "Hello, World!" -Pages $PagesNew-UDDashboard -Title 'PowerShell Universal' -Pages @(
New-UDPage -Name 'Page' -Content {
New-UDAppBar -Children {
New-UDTypography -Text "Title" -Variant h4 -Style @{
marginRight = "50px"
}
New-UDMenu -Variant text -Text "Settings" -Children {
New-UDMenuItem -Text 'Item 1' -OnClick { Invoke-UDRedirect "/item1" }
New-UDMenuItem -Text 'Item 2' -OnClick { Invoke-UDRedirect "/item1" }
New-UDMenuItem -Text 'Item 3' -OnClick { Invoke-UDRedirect "/item1" }
}
New-UDMenu -Variant text -Text "Options" -Children {
New-UDMenuItem -Text 'Item 1' -OnClick { Invoke-UDRedirect "/item1" }
New-UDMenuItem -Text 'Item 2' -OnClick { Invoke-UDRedirect "/item1" }
New-UDMenuItem -Text 'Item 3' -OnClick { Invoke-UDRedirect "/item1" }
}
New-UDMenu -Variant text -Text "Tools" -Children {
New-UDMenuItem -Text 'Item 1' -OnClick { Invoke-UDRedirect "/item1" }
New-UDMenuItem -Text 'Item 2' -OnClick { Invoke-UDRedirect "/item1" }
New-UDMenuItem -Text 'Item 3' -OnClick { Invoke-UDRedirect "/item1" }
}
} -DisableThemeToggle
} -Blank
) New-UDPage -Name 'Home' -Logo '/assets/favicon.png' -Content {
}$Page = New-UDPage -Name 'Home' -Content {
} -HeaderContent {
New-UDButton -Icon (New-UDIcon -Icon Users) -Text 'User'
}
New-UDDashboard -Title "Dashboard" -Pages $PageNew-UDPage -Name "Home" -LoadTitle { "Current Time" + (Get-Date) } -Content { } New-UDPage -Name 'Static Page' -Content {
New-UDTypography (Get-Date)
} -StaticNew-UDPage -Name 'Static Page' -Content {
New-UDDynamic -Content {
New-UDTypography (Get-Date)
}
} -StaticNew-UDForm -Content {
New-UDTextbox -Id 'txtTextField'
New-UDCheckbox -Id 'chkCheckbox'
} -OnSubmit {
Show-UDToast -Message $EventData.txtTextField
Show-UDToast -Message $EventData.chkCheckbox
}New-UDForm -Content {
New-UDTextbox -Id 'txtTextfield'
New-UDCheckbox -Id 'chkCheckbox'
} -OnSubmit {
Show-UDToast -Message $EventData.txtTextfield
Show-UDToast -Message $EventData.chkCheckbox
}New-UDForm -Content {
New-UDRow -Columns {
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
New-UDTextbox -Id 'txtFirstName' -Label 'First Name'
}
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
New-UDTextbox -Id 'txtLastName' -Label 'Last Name'
}
}
New-UDTextbox -Id 'txtAddress' -Label 'Address'
New-UDRow -Columns {
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
New-UDTextbox -Id 'txtState' -Label 'State'
}
New-UDColumn -SmallSize 6 -LargeSize 6 -Content {
New-UDTextbox -Id 'txtZipCode' -Label 'ZIP Code'
}
}
} -OnSubmit {
Show-UDToast -Message $EventData.txtFirstName
Show-UDToast -Message $EventData.txtLastName
}New-UDForm -Content {
New-UDTextbox -Id 'txtTextfield'
} -OnSubmit {
New-UDTypography -Text $EventData.txtTextfield
}New-UDForm -Content {
New-UDTextbox -Id 'txtValidateForm'
} -OnValidate {
$FormContent = $EventData
if ($FormContent.txtValidateForm -eq $null -or $FormContent.txtValidateForm -eq '') {
New-UDFormValidationResult -ValidationError "txtValidateForm is required"
} else {
New-UDFormValidationResult -Valid
}
} -OnSubmit {
Show-UDToast -Message $Body
}New-UDButton -Text 'On Form' -OnClick {
Show-UDModal -Content {
New-UDForm -Content {
New-UDTextbox -Label 'Hello'
} -OnSubmit {
Show-UDToast -Message 'Submitted!'
Hide-UDModal
} -OnCancel {
Hide-UDModal
}
}
}New-UDForm -Content {
} -OnSubmit {
Set-UDElement -Id 'results' -Content {
New-UDCard -Content { "Hello " + (Get-Date) }
}
}
New-UDElement -Id 'results' -Tag 'div'New-UDForm -Schema @{
title = "Test Form"
type = "object"
properties = @{
name = @{
type = "string"
}
age = @{
type = "number"
}
}
} -OnSubmit {
# $EventData.formData.name
# $EventData.formData.age
}New-UDForm -Schema @{
title = "Test Form"
type = "object"
properties = @{
name = @{
type = "string"
}
age = @{
type = "number"
}
}
required = @('name')
} -OnSubmit {
# $EventData.formData.name
# $EventData.formData.age
}New-UDForm -Schema @{
title = "Test"
type = "object"
properties = @{
hostname = @{
title = "Hostname"
type = "string"
}
ipaddress= @{
title = "IP Address"
type = "string"
format = "ipv4"
}
description = @{
title = "Server Description"
type = "string"
}
servertype = @{
title = "Server Type"
type = "string"
enum = "App","DB"
}
environment = @{
title = "Environment"
type = "string"
enum = "Prod", "Dev" , "QA"
}
}
required = @('hostname','ipaddress','description','servertype','environment')
} -uiSchema @{
"ui:order" = @('environment','hostname','ipaddress','description')
} -OnSubmit {
Show-UDModal -Content {
New-UDTypography -Text $EventData.formData
} -Footer {
New-UDButton -Text "Close" -OnClick {Hide-UDModal}
} -Persistent
}New-UDForm -Schema @{
title = "Test Form"
type = "array"
items = @{
type = "object"
properties = @{
name = @{
type = "string"
}
age = @{
type = "number"
}
}
}
} -OnSubmit {
# $EventData[0].formData.name
# $EventData[0].formData.age
}New-UDForm -Script "Script.ps1" -OutputType 'text'






docker versionClient: Docker Engine - Community
Version: 23.0.1
API version: 1.42
Go version: go1.19.5
Git commit: a5ee5b1
Built: Thu Feb 9 19:47:01 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 23.0.1
API version: 1.42 (minimum version 1.12)
Go version: go1.19.5
Git commit: bc3805a
Built: Thu Feb 9 19:47:01 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.18
GitCommit: 2456e983eb9e37e47538f59ea18f2043c9a73640
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker-compose versiondocker compose versionDocker Compose version v2.16.0docker run hello-worldUnable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:ffb13da98453e0f04d33a6eee5bb8e46ee50d08ebe17735fc0779d0349e889e9
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/docker pull ironmansoftware/universal
docker run --name 'PSU' -it -p 5000:5000 ironmansoftware/universaldocker pull ironmansoftware/universal
docker run --name 'PSU' -it -p 80:5000 ironmansoftware/universaldocker pull ironmansoftware/universal
docker run --name 'PSU' -it -p 5000:5000 -v C:\docker\volumes\PSU:/root ironmansoftware/universal docker pull ironmansoftware/universal
docker run --name 'PSU' -it -p 5000:5000 -v /docker/volumes/PSU:/root ironmansoftware/universal docker stop PSUdocker rm PSUdocker rm --force PSUversion: "3.7"
services:
PSU:
container_name: PSU
image: ironmansoftware/universal:latest
ports:
- 5000:5000
restart: unless-stopped
environment:
- TZ=Europe/London
volumes:
- C:\docker\volumes\PSU:/rootversion: "3.7"
services:
PSU:
container_name: PSU
image: ironmansoftware/universal:latest
ports:
- 5000:5000
restart: unless-stopped
environment:
- TZ=Europe/London
volumes:
- /docker/volumes/PSU:/rootdocker compose up -dCreating network "PSU_default" with the default driver
Pulling PSU (ironmansoftware/universal:latest)...
latest: Pulling from ironmansoftware/universal
7608715873ec: Pull complete
4e66273c6cfb: Pull complete
2649c52300c2: Pull complete
a20175666bc7: Pull complete
65ce93bc0653: Pull complete
Digest: sha256:d7ff98e6197d21070aac325c2efbefa393a4952d2e8ba6b1327dc97824ec4d55
Status: Downloaded newer image for ironmansoftware/universal:latest
Creating PSU ... donedocker compose down[+] Running 2/2
â ¿ Container PSU Removed 0.5s
â ¿ Network PSU_default Removed 0.4sversion: "3.7"
services:
PSU:
container_name: PSU
image: ironmansoftware/universal:latest
ports:
- 5000:5000
restart: unless-stopped
environment:
- TZ=Europe/London
- Plugins:0=SQL
- Data__ConnectionString=Server=ServerName; Database=DatabaseName; User Id=UserName; Password=UserPassword;Encrypt=False
- NodeName=mynodename
volumes:
- /docker/volumes/PSU:/rootFROM ironmansoftware/universal:latest
LABEL description="Universal - The ultimate platform for building web-based IT Tools"
EXPOSE 5000
VOLUME ["/home/data"]
ENV Data__RepositoryPath /home/data/Repository
ENV Data__ConnectionString /home/data/database.db
ENV UniversalDashboard__AssetsFolder /home/data/UniversalDashboard
ENV Logging__Path /home/data/logs/log.txt
ENTRYPOINT ["./Universal/Universal.Server"]docker build . --tag=universal-persistentFROM ironmansoftware/universal:1.3.1-windowsservercore-1809
LABEL description="Universal - The ultimate platform for building web-based IT Tools"
EXPOSE 5000
VOLUME ["C:/data"]
ENV Data__RepositoryPath C:/data/Repository
ENV Data__ConnectionString C:/data/database.db
ENV UniversalDashboard__AssetsFolder C:/data/UniversalDashboard
ENV Logging__Path C:/data/logs/log.txt
ENTRYPOINT ["C:/ProgramData/Universal/Universal.Server.exe"]docker build . --tag=universal-persistentdocker run -it --name powershelluniversal --mount source=psudata,target=/home/data --rm -d -p 5000:5000/tcp universal-persistent:latestENV Data__ConnectionString=Data Source=ServerName; Initial Catalog=DatabaseName; Integrated Security=SSPI;
ENV Plugins:0=SQLENV TZ Europe/Amsterdam
RUN apt-get install -y tzdata


This document outlines how to build custom Universal Dashboard components.
- UniversalDashboard.95
- index.23adfdasf.js
- UniversalDashboard.95.psd1
- UniversalDashboard.95.psm1npm initnpm install @babel/core --save-dev
npm install @babel/plugin-proposal-class-properties --save-dev
npm install @babel/plugin-syntax-dynamic-import --save-dev
npm install @babel/polyfill --save-dev
npm install @babel/preset-env --save-dev
npm install @babel/preset-react --save-dev
npm install babel-loader --save-dev
npm install webpack --save-dev
npm install webpack-cli --save-devnpm install universal-dashboard --save
npm install react95 --save
npm install styled-components --save{
"presets": ["@babel/preset-react"]
}var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'dist');
module.exports = (env) => {
const isDev = env == 'development' || env == 'isolated';
return {
entry: {
'ud95' : __dirname + '/index.js'
},
output: {
library: "UD95",
libraryTarget: "var",
path: BUILD_DIR,
filename: isDev ? '[name].bundle.js' : '[name].[hash].bundle.js',
sourceMapFilename: '[name].[hash].bundle.map',
publicPath: "/"
},
module : {
rules : [
{ test: /\.(js|jsx)$/, exclude: [/node_modules/, /public/], loader: 'babel-loader'}
]
},
externals: {
UniversalDashboard: 'UniversalDashboard',
'react': 'react',
'react-dom': 'reactdom'
},
resolve: {
extensions: ['.json', '.js', '.jsx']
}
};
}import React from 'react';
import { withComponentFeatures } from 'universal-dashboard';
import { Button } from 'react95';
const UD95Button = props => {
const p = {
onClick: () => props.onClick()
}
return <Button {...p}>{props.text}</Button>
}
export default withComponentFeatures(UD95Button);import { registerComponent } from 'universal-dashboard'
import UD95Button from './component';
registerComponent("ud95-button", UD95Button);npm run build$JsFile = Get-ChildItem "$PSScriptRoot\ud95.*.js"
$AssetId = [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($JsFile.FullName)function New-UD95Button {
param(
[Parameter()]
[string]$Id = [Guid]::NewGuid(),
[Parameter()]
[string]$Text,
[Parameter()]
[Endpoint]$OnClick
)
if ($OnClick)
{
$OnClick.Register($Id, $PSCmdlet)
}
@{
type = "ud95-button"
isPlugin = $true
assetId = $AssetId
id = $Id
text = $Text
onClick = $OnClick
}
}task Clean {
Remove-Item "$PSScriptRoot\dist" -Recurse -Force
}
task NpmInstall {
& {
$ErrorActionPreference = 'SilentlyContinue'
Push-Location $PSScriptRoot
npm install
Pop-Location
}
}
task NpmBuild {
& {
$ErrorActionPreference = 'SilentlyContinue'
Push-Location $PSScriptRoot
npm run build
Pop-Location
}
}
task Stage {
Copy-Item "$PSScriptRoot\UniversalDashboard.95.*" "$PSScriptRoot\dist"
}
task . Clean, NpmInstall, NpmBuild, Stagefunction New-UDText {
param(
[Parameter()]
[string]$Text
)
@{
type = "text"
isPlugin = $true
assetId = $AssetId
text = $Text
}
}import React from 'react';
import { withComponentFeatures } from 'universal-dashboard';
const UDText = props => {
return <div>{props.text}</div>
}
export default withComponentFeatures(UDText);function New-UD95Button {
param(
[Parameter()]
[string]$Id = [Guid]::NewGuid(),
[Parameter()]
[string]$Text,
[Parameter()]
[Endpoint]$OnClick
)
if ($OnClick)
{
$OnClick.Register($Id, $PSCmdlet)
}
@{
type = "ud95-button"
isPlugin = $true
assetId = $AssetId
id = $Id
text = $Text
onClick = $OnClick
}
}New-UD95Button -Text 'Hello' -OnClick {
Show-UDToast -Message 'Test'
}import React from 'react';
import { withComponentFeatures } from 'universal-dashboard';
import { Button } from 'react95';
const UD95Button = props => {
const p = {
onClick: () => props.onClick()
}
return <Button {...p}>{props.text}</Button>
}
export default withComponentFeatures(UD95Button);const UDTextField = (props) => {
const onChange = (e) => {
props.setState({value: e.target.value})
}
return <TextField {...props} onChange={onChange} />
}
export default withComponentFeatures(UDTextField);Endpoint configuration for Universal APIs.




New-PSUEndpoint -Url '/endpoint' -Method 'GET' -Endpoint {
"Hello, world!"
}Invoke-RestMethod http://localhost:5000/endpoint



New-PSUEndpoint -Url '/user/:id' -Method 'GET' -Endpoint {
Get-User -Id $Id
}Invoke-RestMethod http://localhost:5000/user/123New-PSUEndpoint -Url '/user' -Method 'GET' -Endpoint {
Get-User -Id $Id
}Invoke-RestMethod http://localhost:5000/user?Id=123New-PSUEndpoint -Url "/api/v1.0/CWE914Test" -Description "Vulnerable to CWE-914" -Endpoint {
if($ChallengeInputData -eq "AcceptableInput") {
$IsChallengePassed = $true
}
if($IsChallengePassed) {
"Challenge passed. Here is Sensitive Information"
} else {
"Challenge not passed"
}
}New-PSUEndpoint -Url "/api/v1.0/CWE914Test" -Description "Not Vulnerable to CWE-914" -Endpoint {
Param(
$ChallengeInputData
)
if($ChallengeInputData -eq "AcceptableInput") {
$IsChallengePassed = $true
}
if($IsChallengePassed) {
"Challenge passed. Here is Sensitive Information"
} else {
"Challenge not passed"
}
}$Headers['Content-Type']$Cookies['Request-Cookie']New-PSUApiResponse -StatusCode 200 -Cookies @{
ResponseCookie = '123'
}New-PSUEndpoint -Url '/user' -Method Post -Endpoint {
$User = ConvertFrom-Json $Body
New-User $User
}Invoke-RestMethod http://localhost:5000/user -Method Post -Body "{'username': 'adam'}"New-PSUEndpoint -Url '/user' -Method Post -Endpoint {
param([Parameter(Mandatory)]$userName, $FirstName, $LastName)
New-User $UserName -FirstName $FirstName -LastName $LastName
}Invoke-RestMethod http://localhost:5000/user -Method Post -Body @{
UserName = "adriscoll"
FirstName = "Adam"
LastName = "Driscoll"
}New-PSUEndpoint -Url '/user' -Method Post -Endpoint {
param([Parameter(Mandatory)]$userName, $FirstName, $LastName)
New-User $UserName -FirstName $FirstName -LastName $LastName
}Invoke-RestMethod http://localhost:5000/user -Method Post -Body (@{
UserName = "adriscoll"
FirstName = "Adam"
LastName = "Driscoll"
} | ConvertTo-Json) -ContentType 'application/json'New-PSUEndpoint -Url '/user/:name' -Endpoint {
param([Parameter(Mandatory)$Name, $Role = "Default")
}New-PSUEndpoint -Url '/file' -Method Post -Endpoint {
$Data
}
PS C:\Users\adamr> iwr http://localhost:5000/file -method post -InFile '.\Desktop\add-dashboard.png'
StatusCode : 200
StatusDescription : OK
Content : [137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,2,17,0,0,1,92,8,2,0,0,0,249,210,123,106,0,0,0,1,
115,82,71,66,0,174,206,28,233,0,0,0,4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,0,9,112,72,89,115,0,
0,…New-PSUEndpoint -Url '/file' -Method Post -Endpoint {
[IO.File]::WriteAllBytes("tempfile.dat", $Data)
}New-PSUEndpoint -Url '/image' -Endpoint {
$ImageData = [IO.File]::ReadAllBytes("image.jpeg")
New-PSUApiResponse -ContentType 'image/jpg' -Data $ImageData
}New-PSUEndpoint -Url '/file' -Method Get -Endpoint {
New-PSUApiResponse -StatusCode 410
}New-PSUEndpoint -Url '/file' -Method Get -Endpoint {
New-PSUApiResponse -Body "Not what you're looking for." -StatusCode 404
}PS C:\Users\adamr\Desktop> invoke-restmethod http://localhost:8080/file
Invoke-RestMethod: Not what you're looking for.New-PSUEndpoint -Url '/file' -Method Get -Endpoint {
New-PSUApiResponse -Body "<xml><node>1</node><node2>2</node2></xml>" -ContentType 'text/xml'
}<#
.SYNOPSIS
This is an endpoint
.DESCRIPTION
This is a description
.PARAMETER ID
This is an ID.
#>
param($ID)
$Id#region PSUHeader
[Documentation()]
class MyReturnType {
[string]$Value
}
#endregion
New-PSUEndpoint -Url "/documented" -Method @('GET') -Endpoint {
<#
.SYNOPSIS
This is an endpoint
.DESCRIPTION
This is a description
.PARAMETER Id
This is an ID.
.PARAMETER AnotherOne
This is AnotherOne
.OUTPUTS
200:
Description: This is an output value.
Content:
application/json: MyReturnType
400:
Description: Invalid input
.INPUTS
Required: false
Description: This is an input value.
Content:
application/json: MyReturnType
#>
param($Id, $AnotherOne)
} -AuthenticationNew-PSUEnvironment -Name 'Env' -Path 'powershell.exe' -PersistentRunspaceSet-PSUSetting -ApiEnvironment 'Env'New-PSUEndpoint -Url "/path" -Path "endpoint-path.ps1"public class ApiRequest
{
public long Id;
public ICollection<KeyValue> Variables;
public IEnumerable<ApiFile> Files { get; set; };
public string Url;
public ICollection<KeyValue> Headers;
public byte[] Data;
public int ErrorAction;
public ICollection<KeyValue> Parameters;
public string Method;
public ICollection<KeyValue> Cookies;
public string ClaimsPrincipal;
public string ContentType;
}var dm = ServiceProvider.GetService(typeof(IDashboardManager));
var dashboard = dm.GetDashboard(1);
dm.Restart(dashboard);return new ApiResponse {
StatusCode = 404
};New-PSUEndpoint -Url /csharp -Path endpoint.cs -Environment 'C#'




Charting components for Universal Dashboard.


Data grid component for Universal Dashboard.

$Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'bar' -Data $Data -DataProperty CPU -LabelProperty ProcessName $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'bar' -Data $Data -DataProperty CPU -LabelProperty ProcessName $GraphPrep = @(
@{ RAM = "Server1"; AvailableRam = 128; UsedRAM = 10 }
@{ RAM = "Server2"; AvailableRam = 64; UsedRAM = 63 }
@{ RAM = "Server3"; AvailableRam = 48; UsedRAM = 40 }
@{ RAM = "Server4"; AvailableRam = 64;; UsedRAM = 26 }
@{ RAM = "Server5"; AvailableRam = 128; UsedRAM = 120 }
)
$AvailableRamDataSet = New-UDChartJSDataset -DataProperty AvailableRAM -Label 'Available' -BackgroundColor blue
$UsedRamDataset = New-UDChartJSDataset -DataProperty UsedRAM -Label 'Used' -BackgroundColor red
$Options = @{
Type = 'bar'
Data = $GraphPrep
Dataset = @($AvailableRamDataSet, $UsedRamDataset)
LabelProperty = "RAM"
Options = @{
scales = @{
xAxes =
@{
stacked = $true
}
yAxes =
@{
stacked = $true
}
}
}
}
New-UDChartJS @Options $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'bar' -Data $Data -DataProperty CPU -LabelProperty ProcessName -Options @{
indexAxis = "y"
plugins = @{
legend = @{
position = "right"
}
}
}p$Data = @(
@{ x = 1; y = 10; r = 15 }
@{ x = 12; y = 25; r = 35 }
@{ x = 8; y = 10; r = 95 }
@{ x = 6; y = 95; r = 25 }
)
New-UDChartJS -Type 'bubble' -Data $Data $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'line' -Data $Data -DataProperty CPU -LabelProperty ProcessName $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'doughnut' -Data $Data -DataProperty CPU -LabelProperty ProcessName $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'pie' -Data $Data -DataProperty CPU -LabelProperty ProcessName $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'radar' -Data $Data -DataProperty CPU -LabelProperty ProcessName $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
$Options = @{
Type = 'bar'
Data = $Data
BackgroundColor = 'Red'
BorderColor = '#c61d4a'
HoverBackgroundColor = 'Blue'
HoverBorderColor = '#451dc6'
DataProperty = 'CPU'
LabelProperty = 'ProcessName'
}
New-UDChartJS @Options$Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
$CPUDataset = New-UDChartJSDataset -DataProperty CPU -Label CPU -BackgroundColor '#126f8c'
$MemoryDataset = New-UDChartJSDataset -DataProperty HandleCount -Label 'Handle Count' -BackgroundColor '#8da322'
$Options = @{
Type = 'bar'
Data = $Data
Dataset = @($CPUDataset, $MemoryDataset)
LabelProperty = "ProcessName"
}
New-UDChartJS @Options $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
$Options = @{
Type = 'bar'
Data = $Data
DataProperty = 'CPU'
LabelProperty = "ProcessName"
OnClick = {
Show-UDToast -Message $Body
}
}
New-UDChartJS @OptionsNew-UDDynamic -Content {
$Data = 1..10 | % {
[PSCustomObject]@{ Name = $_; value = get-random }
}
New-UDChartJS -Type 'bar' -Data $Data -DataProperty Value -Id 'test' -LabelProperty Name -BackgroundColor Blue
} -AutoRefresh -AutoRefreshInterval 1New-UDChartJSMonitor -LoadData {
Get-Random -Max 100 | Out-UDChartJSMonitorData
} -Labels "Random" -ChartBackgroundColor "#297741" -RefreshInterval 1 $Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'bar' -Data $Data -DataProperty CPU -LabelProperty ProcessName -Options @{
legend = @{
display = $false
}
}$Data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10
New-UDChartJS -Type 'bar' -Data $Data -DataProperty CPU -LabelProperty ProcessName -Options @{
plugins = @{
legend = @{
title = @{
display = $true
text = 'Bar Chart'
}
}
}
}$Data = 1..10 | ForEach-Object {
$item = Get-Random -Max 1000
[PSCustomObject]@{
Name = "Test$item"
Value = $item
}
}
New-UDNivoChart -Id 'autoRefreshingNivoBar' -Bar -Keys "value" -IndexBy 'name' -Data $Data -Height 500 -Width 1000$Data = @(
@{
country = 'USA'
burgers = (Get-Random -Minimum 10 -Maximum 100)
fries = (Get-Random -Minimum 10 -Maximum 100)
sandwich = (Get-Random -Minimum 10 -Maximum 100)
}
@{
country = 'Germany'
burgers = (Get-Random -Minimum 10 -Maximum 100)
fries = (Get-Random -Minimum 10 -Maximum 100)
sandwich = (Get-Random -Minimum 10 -Maximum 100)
}
@{
country = 'Japan'
burgers = (Get-Random -Minimum 10 -Maximum 100)
fries = (Get-Random -Minimum 10 -Maximum 100)
sandwich = (Get-Random -Minimum 10 -Maximum 100)
}
)
$Pattern = New-UDNivoPattern -Dots -Id 'dots' -Background "inherit" -Color "#38bcb2" -Size 4 -Padding 1 -Stagger
$Fill = New-UDNivoFill -ElementId "fries" -PatternId 'dots'
New-UDNivoChart -Definitions $Pattern -Fill $Fill -Bar -Data $Data -Height 400 -Width 900 -Keys @('burgers', 'fries', 'sandwich') -IndexBy 'country'New-UDDynamic -Content {
$Data = 1..10 | ForEach-Object {
$item = Get-Random -Max 1000
[PSCustomObject]@{
Name = "Test$item"
Value = $item
}
}
New-UDNivoChart -Id 'autoRefreshingNivoBar' -Bar -Keys "Value" -IndexBy 'name' -Data $Data -Height 500 -Width 1000
} -AutoRefresh$Data = @(
@{
country = 'USA'
burgers = (Get-Random -Minimum 10 -Maximum 100)
fries = (Get-Random -Minimum 10 -Maximum 100)
sandwich = (Get-Random -Minimum 10 -Maximum 100)
}
@{
country = 'Germany'
burgers = (Get-Random -Minimum 10 -Maximum 100)
fries = (Get-Random -Minimum 10 -Maximum 100)
sandwich = (Get-Random -Minimum 10 -Maximum 100)
}
@{
country = 'Japan'
burgers = (Get-Random -Minimum 10 -Maximum 100)
fries = (Get-Random -Minimum 10 -Maximum 100)
sandwich = (Get-Random -Minimum 10 -Maximum 100)
}
)
New-UDNivoChart -Bar -Data $Data -Height 400 -Width 900 -Keys @('burgers', 'fries', 'sandwich') -IndexBy 'country' -OnClick {
Show-UDToast -Message $EventData -Position topLeft
}New-Example -Title 'Bar' -Description '' -Example {
$Data = 1..10 | ForEach-Object {
$item = Get-Random -Max 1000
[PSCustomObject]@{
Name = "Test$item"
Value = $item
}
}
New-UDNivoChart -Bar -Keys "Value" -IndexBy 'name' -Data $Data -Height 500 -Width 1000
}$TreeData = @{
Name = "root"
children = @(
@{
Name = "first"
children = @(
@{
Name = "first-first"
Count = 7
}
@{
Name = "first-second"
Count = 8
}
)
},
@{
Name = "second"
Count = 21
}
)
}
New-UDNivoChart -Bubble -Data $TreeData -Value "count" -Identity "name" -Height 500 -Width 800$Data = @()
for($i = 365; $i -gt 0; $i--) {
$Data += @{
day = (Get-Date).AddDays($i * -1).ToString("yyyy-MM-dd")
value = Get-Random
}
}
$From = (Get-Date).AddDays(-365)
$To = Get-Date
New-UDNivoChart -Calendar -Data $Data -From $From -To $To -Height 500 -Width 1000 -MarginTop 50 -MarginRight 130 -MarginBottom 50 -MarginLeft 60$Data = @(
@{
state = "idaho"
cats = 72307
dogs = 23429
moose = 23423
bears = 784
}
@{
state = "wisconsin"
cats = 2343342
dogs = 3453623
moose = 1
bears = 23423
}
@{
state = "montana"
cats = 9234
dogs = 3973457
moose = 23472
bears = 347303
}
@{
state = "colorado"
cats = 345973789
dogs = 0237234
moose = 2302
bears = 2349772
}
)
New-UDNivoChart -Heatmap -Data $Data -IndexBy 'state' -keys @('cats', 'dogs', 'moose', 'bears') -Height 500 -Width 1000 -MarginTop 50 -MarginRight 130 -MarginBottom 50 -MarginLeft 60[array]$Data = [PSCustomObject]@{
id = "DataSet"
data = (1..20 | ForEach-Object {
$item = Get-Random -Max 500
[PSCustomObject]@{
x = "Test$item"
y = $item
}
})
}
New-UDNivoChart -Line -Data $Data -Height 500 -Width 1000 -LineWidth 1$Data = 1..10 | ForEach-Object {
@{
"Adam" = Get-Random
"Alon" = Get-Random
"Lee" = Get-Random
"Frank" = Get-Random
"Bill" = Get-Random
}
}
New-UDNivoChart -Stream -Data $Data -Height 500 -Width 1000 -Keys @("adam", "alon", "lee", "frank", "bill")$TreeData = @{
Name = "root"
children = @(
@{
Name = "first"
children = @(
@{
Name = "first-first"
Count = 7
}
@{
Name = "first-second"
Count = 8
}
)
},
@{
Name = "second"
Count = 21
}
)
}
New-UDNivoChart -Treemap -Data $TreeData -Value "count" -Identity "name" -Height 500 -Width 800







New-UDDataGrid -LoadRows {
$Data = @(
@{ Name = 'Adam'; Number = Get-Random}
@{ Name = 'Tom'; Number = Get-Random}
@{ Name = 'Sarah'; Number = Get-Random}
)
@{
rows = $Data
rowCount = $Data.Length
}
} -Columns @(
@{ field = "name"}
@{ field = "number"}
) -AutoHeightNew-UDDataGrid -LoadRows {
$Rows = 1..100 | % {
@{ Name = 'Adam'; Number = Get-Random}
}
@{
rows = $Rows
rowCount = $Rows.Length
}
} -Columns @(
@{ field = "name"; render = { New-UDTypography $EventData.number }}
@{ field = "number"}
) -AutoHeightNew-UDDataGrid -LoadRows {
$Rows = 1..100 | % {
@{ Name = 'Adam'; Number = "This column is a very long string. This column is a very long string. This column is a very long string. This column is a very long string. This column is a very long string. This column is a very long string."}
}
@{
rows = $Rows
rowCount = $Rows.Length
}
} -Columns @(
@{ field = "name"; render = { New-UDTypography $EventData.number }}
@{ field = "number"; flex = 1.0}
) -AutoHeightNew-UDDataGrid -LoadRows {
$Rows = 1..100 | % {
@{ Name = 'Adam'; Number = Get-Random}
}
@{
rows = $Rows | Select-Object -First $EventData.pageSize -Skip ($EventData.page * $EventData.pageSize)
rowCount = $Rows.Length
}
} -Columns @(
@{ field = "name"; }
@{ field = "number"}
) -AutoHeight -Pagination@{
items = @(
@{
columnField = "Name"
overatorValue = "contains"
value = "test"
}
)
linkOperator = "and"
}$EventData.Sort.'0'.fieldNew-UDDataGrid -LoadRows {
$Data = @(
@{ Name = 'Adam'; Number = Get-Random }
@{ Name = 'Tom'; Number = Get-Random }
@{ Name = 'Sarah'; Number = Get-Random }
)
@{
rows = $Data
rowCount = $Data.Length
}
} -Columns @(
@{ field = "Name" }
@{ field = "number" }
) -AutoHeight -LoadDetailContent {
Show-UDToast $Body
New-UDAlert -Text $EventData.row.Name
}@{
newRow = @{}
oldRow = @{}
}New-UDDataGrid -LoadRows {
$Data = @(
@{ Name = 'Adam'; number = Get-Random }
@{ Name = 'Tom'; number = Get-Random }
@{ Name = 'Sarah'; number = Get-Random }
)
@{
rows = $Data
rowCount = $Data.Length
}
} -Columns @(
@{ field = "Name"; editable = $true }
@{ field = "number" ; editable = $true }
) -AutoHeight -OnEdit {
Show-UDToast "Editing $Body"
}New-UDDataGrid -LoadRows {
$Data = @(
@{ Name = 'Adam'; Number = Get-Random}
@{ Name = 'Tom'; Number = Get-Random}
@{ Name = 'Sarah'; Number = Get-Random}
)
@{
rows = $Data
rowCount = $Data.Length
}
} -Columns @(
@{ field = "name"}
@{ field = "number"}
) -AutoHeight -OnExport {
$Data = $EventData | Select-Object -Expand name
Out-UDDataGridExport -Data $Data -FileName 'export.txt' | Out-String
}New-UDDashboard -Title 'PowerShell Universal' -Content {
$Data = 1..10000 | % {
@{ Name = 'Adam'; Number = Get-Random }
}
New-UDDataGrid -LoadRows {
$Data | Out-UDDataGridData -Context $EventData
} -Columns @(
@{ field = "name"; render = {
New-UDButton -Icon (New-UDIcon -Icon User) -OnClick { Show-UDToast $EventData.Name } }
}
@{ field = "number" }
) -AutoHeight -Pagination
} function Out-UDSQLDataGrid {
param(
[Parameter(Mandatory)]
$Context,
[Parameter(Mandatory)]
[string]$Table,
[Parameter(Mandatory)]
[string]$SqlInstance,
[Parameter(Mandatory)]
[string]$Database
)
End {
$simpleFilter = @()
if($null -ne $Context.Filter.Items -and $Context.Filter.Items.Count -gt 0) {
$linkOperator = $Context.Filter.linkOperator #The link operator is 'AND' or 'OR'. It will always be one or the other for all properties
foreach ($item in $Context.Filter.Items) {
$simpleFilter += [PSCustomObject]@{
Property = $item.columnField
Value = $item.Value
Operator = $item.operatorValue
}
}
}
if($null -ne $simpleFilter -and $simpleFilter.Count -gt 0) {
$count = 1
foreach($filter in $simpleFilter) {
if ($count -gt 1) {
$SqlFilter += " $($linkOperator) "
} else {
$SqlFilter += " WHERE "
}
switch ($filter.Operator) {
"contains" { $SqlFilter += " $($filter.Property) LIKE '%$($filter.Value)%' " }
"equals" { $SqlFilter += " $($filter.Property) = '$($filter.Value)' " }
"startsWith" { $SqlFilter += " $($filter.Property) LIKE '$($filter.Value)%' " }
"endsWith" { $SqlFilter += " $($filter.Property) LIKE '%$($filter.Value)' " }
"isAnyOf" {
$count = 1
foreach($val in $filter.Value){
if($count -gt 1) {
$list += ", '$val'"
} else {
$list += "'$val'"
}
$count += 1
}
$SqlFilter += " $($filter.Property) IN ($($list)) "
}
"isempty" { $SqlFilter += " TRIM ($($filter.Property)) IS NULL " }
"isnotempty" { $SqlFilter += " TRIM ($($filter.Property)) IS NOT NULL " }
"notequals" { $SqlFilter += " $($filter.Property) != '$($filter.Value)' " }
"notcontains" { $SqlFilter += " $($filter.Property) NOT LIKE '%$($filter.Value)%' " }
}
$count += 1
}
} else {
$SqlFilter = $null
}
$totalCount = (Invoke-DbaQuery -SqlInstance $SqlInstance -Database $Database -Query "SELECT COUNT(*) As Count FROM $Table $SqlFilter" -SqlParameters $SqlParameters).Count
$sort = $Context.Sort.'0'
if ($sort)
{
$sqlSort = "ORDER BY $($sort.field) $($sort.Sort) "
} else {
$sqlSort = "ORDER BY (SELECT NULL)"
}
$sqlPage = "OFFSET $($Context.Page * $Context.PageSize) ROWS FETCH NEXT $($Context.PageSize) ROWS ONLY;"
if($null -ne $SqlFilter) {
$Query = "SELECT * FROM $Table $sqlFilter $sqlSort $sqlPage"
} else {
$Query = "SELECT * FROM $Table $sqlSort $sqlPage"
}
$Rows = Invoke-DbaQuery -SqlInstance $SqlInstance -Database $Database -Query $Query -As PSObject -SqlParameters $SqlParameters
@{
rows = [Array]$Rows
rowCount = $TotalCount
}
}
}
New-UDDashboard -Title 'PowerShell Universal' -Content {
New-UDDataGrid -LoadRows {
Out-UDSqlDataGrid -Context $EventData -SqlInstance "(localdb)\MSSQLLocalDb" -Database "PSU" -Table "Job"
} -Columns @(
@{ field = "id"; }
@{ field = "startTime"; }
@{ field = "status"; render = {
if ($EventData.Status -eq 2) {
New-UDAlert -Severity 'Success' -Text 'Success'
}
if ($EventData.Status -eq 3) {
New-UDAlert -Severity 'Error' -Text 'Failed'
}
} }
) -AutoHeight -Pagination
}























Table component for Universal Dashboard


$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
New-UDTable -Data $Data$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
$Columns = @(
New-UDTableColumn -Property Dessert -Title "A Dessert"
New-UDTableColumn -Property Calories -Title Calories
New-UDTableColumn -Property Fat -Title Fat
New-UDTableColumn -Property Carbs -Title Carbs
New-UDTableColumn -Property Protein -Title Protein
)
New-UDTable -Id 'customColumnsTable' -Data $Data -Columns $Columns$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 1; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 200; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
$Columns = @(
New-UDTableColumn -Property Dessert -Title Dessert -Render {
New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDToast -Message $EventData.Dessert }
}
New-UDTableColumn -Property Calories -Title Calories
New-UDTableColumn -Property Fat -Title Fat
New-UDTableColumn -Property Carbs -Title Carbs
New-UDTableColumn -Property Protein -Title Protein
)
New-UDTable -Data $Data -Columns $Columns -Sort -Export$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
$Columns = @(
New-UDTableColumn -Property Dessert -Title Dessert -Render {
New-UDButton -Id "btn$($EventData.Dessert)" -Text "Click for Dessert!" -OnClick { Show-UDToast -Message $EventData.Dessert }
}
New-UDTableColumn -Property Calories -Title Calories -Width 5 -Truncate
New-UDTableColumn -Property Fat -Title Fat
New-UDTableColumn -Property Carbs -Title Carbs
New-UDTableColumn -Property Protein -Title Protein
)
New-UDTable -Data $Data -Columns $Columns -Sort$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
$Columns = @(
New-UDTableColumn -Property Dessert -Title "A Dessert" -Filter -FilterType AutoComplete
New-UDTableColumn -Property Calories -Title Calories -Filter -FilterType Range
New-UDTableColumn -Property Fat -Title Fat -Filter -FilterType Range
New-UDTableColumn -Property Carbs -Title Carbs -Filter -FilterType Range
New-UDTableColumn -Property Protein -Title Protein -Filter -FilterType Range
)
New-UDTable -Id 'customColumnsTable' -Data $Data -Columns $Columns -ShowFilter$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
New-UDTable -Data $Data -ShowSearch$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
$Columns = @(
New-UDTableColumn -Property Dessert -Title "A Dessert" -IncludeInSearch
New-UDTableColumn -Property Calories -Title Calories
New-UDTableColumn -Property Fat -Title Fat
New-UDTableColumn -Property Carbs -Title Carbs
New-UDTableColumn -Property Protein -Title Protein
)
New-UDTable -Id 'customColumnsTable' -Data $Data -Columns $Columns -ShowSearch$Columns = @(
New-UDTableColumn -Property Name -Title "Name" -ShowFilter
New-UDTableColumn -Property Value -Title "Value" -ShowFilter
)
$Data = 1..1000 | ForEach-Object {
[PSCustomObject]@{
Name = "Record-$_"
Value = $_
}
}
New-UDTable -Columns $Columns -LoadData {
foreach($Filter in $EventData.Filters)
{
$Data = $Data | Where-Object -Property $Filter.Id -Match -Value $Filter.Value
}
$TotalCount = $Data.Count
if (-not [string]::IsNullOrEmpty($EventData.OrderBy.Field))
{
$Descending = $EventData.OrderDirection -ne 'asc'
$Data = $Data | Sort-Object -Property ($EventData.orderBy.Field) -Descending:$Descending
}
$Data = $Data | Select-Object -First $EventData.PageSize -Skip ($EventData.Page * $EventData.PageSize)
$Data | Out-UDTableData -Page $EventData.Page -TotalCount $TotalCount -Properties $EventData.Properties
} -ShowFilter -ShowSort -ShowPagination$Columns = @(
New-UDTableColumn -Property Name -Title "Name" -ShowFilter
New-UDTableColumn -Property Value -Title "Value" -ShowFilter
)
$Data = 1..1000 | ForEach-Object {
@{
Name = "Record-$_"
Value = $_
}
}
New-UDButton -Text 'Get Filtered Data' -OnClick {
$Element = Get-UDElement -Id 'filteredTable'
Show-UDModal -Content {
New-UDElement -Tag 'pre' -Content {
$Element | ConvertTo-Json
}
}
}
New-UDTable -Id 'filteredTable' -Columns $Columns -LoadData {
foreach($Filter in $EventData.Filters)
{
$Data = $Data | Where-Object -Property $Filter.Id -Match -Value $Filter.Value
}
$TotalCount = $Data.Count
if (-not [string]::IsNullOrEmpty($EventData.OrderBy))
{
$Descending = $EventData.OrderDirection -ne 'asc'
$Data = $Data | Sort-Object -Property $EventData.orderBy -Descending:$Descending
}
$Data = $Data | Select-Object -First $EventData.PageSize -Skip ($EventData.Page * $EventData.PageSize)
$Data | Out-UDTableData -Page $EventData.Page -TotalCount $TotalCount -Properties $EventData.Properties
} -ShowFilter -ShowSort -ShowPagination$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
New-UDTable -Data $Data -Paging -PageSize 2$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
New-UDTable -Data $Data -ShowSort @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
$Columns = @(
New-UDTableColumn -Property Dessert -Title "A Dessert" -ShowSort
New-UDTableColumn -Property Calories -Title Calories
New-UDTableColumn -Property Fat -Title Fat
New-UDTableColumn -Property Carbs -Title Carbs -ShowSort
New-UDTableColumn -Property Protein -Title Protein -ShowSort
)
New-UDTable -Id 'customColumnsTable' -Data $Data -Columns $Columns$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
New-UDTable -Data $Data -ShowSort -DisableSortRemove$Data = try { get-service -ea Stop | select Name,@{n = "Status";e={ $_.Status.ToString()}},@{n = "StartupType";e={ $_.StartupType.ToString()}},@{n = "StartType";e={ $_.StartType.ToString()}} } catch {}
$Columns = @(
New-UDTableColumn -Property Name -Title "Service Name" -ShowSort -IncludeInExport -IncludeInSearch -ShowFilter -FilterType text
New-UDTableColumn -Property Status -Title Status -ShowSort -DefaultSortColumn -IncludeInExport -IncludeInSearch -ShowFilter -FilterType select
New-UDTableColumn -Property StartupType -Title StartupType -IncludeInExport -ShowFilter -FilterType select
New-UDTableColumn -Property StartType -Title StartType -IncludeInExport -ShowFilter -FilterType select
)
New-UDTable -Id 'service_table' -Data $Data -Columns $Columns -Title 'Services' -ShowSearch -ShowPagination -ShowSelection -Dense -OnRowSelection {
$Item = $EventData
Show-UDToast -Message "$($Item | out-string)"
}
New-UDButton -Text "GET Rows" -OnClick {
$value = Get-UDElement -Id "service_table"
Show-UDToast -Message "$( $value.selectedRows | Out-String )"
}@{
Id = 0
Name = 'AESMService',
Status = 'Running'
StartupType = 'AutomaticDelayedStart'
StartType = 'Automation'
selected = $true
}New-UDTable -Data (Get-Service) -OnRowExpand {
New-UDAlert -Text $EventData.DisplayName
} -Columns @(
New-UDTableColumn -Title 'Name' -Property 'Name'
New-UDTableColumn -Title 'Status' -Property 'Status'
)$Data = try { get-service -ea Stop | select Name,@{n = "Status";e={ $_.Status.ToString()}},@{n = "StartupType";e={ $_.StartupType.ToString()}},@{n = "StartType";e={ $_.StartType.ToString()}} } catch {}
$Columns = @(
New-UDTableColumn -Property Name -Title "Service Name" -IncludeInExport
New-UDTableColumn -Property Status -Title Status
New-UDTableColumn -Property StartupType
New-UDTableColumn -Property StartType -IncludeInExport
)
New-UDTable -Id 'service_table' -Data $Data -Columns $Columns -Title 'Services' -ShowSearch -ShowPagination -Dense -Export$Data = try { get-service -ea Stop | select Name,@{n = "Status";e={ $_.Status.ToString()}},@{n = "StartupType";e={ $_.StartupType.ToString()}},@{n = "StartType";e={ $_.StartType.ToString()}} } catch {}
$Columns = @(
New-UDTableColumn -Property Name -Title "Service Name" -IncludeInExport
New-UDTableColumn -Property Status -Title Status
New-UDTableColumn -Property StartupType
New-UDTableColumn -Property StartType -IncludeInExport -Hidden
)
New-UDTable -Id 'service_table' -Data $Data -Columns $Columns -Title 'Services' -ShowSearch -ShowPagination -Dense -Export$Columns = @(
New-UDTableColumn -Property Name -Title "Name" -ShowFilter -IncludeInExport
New-UDTableColumn -Property Value -Title "Value" -ShowFilter -IncludeInExport
)
$Data = 1..1000 | ForEach-Object {
[PSCustomObject]@{
Name = "Record-$_"
Value = $_
}
}
New-UDTable -Columns $Columns -LoadData {
foreach($Filter in $EventData.Filters)
{
$Data = $Data | Where-Object -Property $Filter.Id -Match -Value $Filter.Value
}
$TotalCount = $Data.Count
if (-not [string]::IsNullOrEmpty($EventData.OrderBy.Field))
{
$Descending = $EventData.OrderDirection -ne 'asc'
$Data = $Data | Sort-Object -Property ($EventData.orderBy.Field) -Descending:$Descending
}
$Data = $Data | Select-Object -First $EventData.PageSize -Skip ($EventData.Page * $EventData.PageSize)
$Data | Out-UDTableData -Page $EventData.Page -TotalCount $TotalCount -Properties $EventData.Properties
} -ShowFilter -ShowSort -ShowPagination -Export -OnExport {
$Query = $Body | ConvertFrom-Json
<# Query will contain
filters: []
orderBy: undefined
orderDirection: ""
page: 0
pageSize: 5
properties: (5) ["dessert", "calories", "fat", "carbs", "protein"]
search: ""
totalCount: 0
allRows: true
#>
$Data | ConvertTo-Json
}$Data = try { get-service -ea Stop | select Name,@{n = "Status";e={ $_.Status.ToString()}},@{n = "StartupType";e={ $_.StartupType.ToString()}},@{n = "StartType";e={ $_.StartType.ToString()}} } catch {}
$Columns = @(
New-UDTableColumn -Property Name -Title "Service Name" -IncludeInExport
New-UDTableColumn -Property Status -Title Status
New-UDTableColumn -Property StartupType
New-UDTableColumn -Property StartType -IncludeInExport
)
New-UDTable -Id 'service_table' -Data $Data -Columns $Columns -Title 'Services' -ShowSearch -ShowPagination -Dense -Export -ExportOption "csv"$Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
)
$Option = New-UDTableTextOption -Search "Search all these records"
New-UDTable -Data $Data -TextOption $Option -ShowSearchNew-UDDynamic -Id 'table' -Content {
$Data = Get-Service
New-UDTable -Data $Data -Paging
} -LoadingComponent {
"Loading"
}
New-UDButton -Text 'Refresh Table' -OnClick {
Sync-UDElement -Id 'table'
}New-UDButton -Text 'Table1' -OnClick { Sync-UDElement -Id 'Table1' }
$Columns = @(
New-UDTableColumn -Property Name -Title "Name" -ShowFilter -Render { $EventData.Name }
New-UDTableColumn -Property Value -Title "Value" -ShowFilter
)
New-UDTable -Columns $Columns -LoadData {
$Data = 1..1000 | ForEach-Object {
@{
Name = "Record-$_"
Value = $_
}
}
foreach($Filter in $EventData.Filters)
{
$Data = $Data | Where-Object -Property $Filter.Id -Match -Value $Filter.Value
}
$TotalCount = $Data.Count
if (-not [string]::IsNullOrEmpty($EventData.OrderBy))
{
$Descending = $EventData.OrderDirection -ne 'asc'
$Data = $Data | Sort-Object -Property $EventData.orderBy -Descending:$Descending
}
$Data = $Data | Select-Object -First $EventData.PageSize -Skip ($EventData.Page * $EventData.PageSize)
$Data | Out-UDTableData -Page $EventData.Page -TotalCount $TotalCount -Properties $EventData.Properties
} -ShowFilter -ShowSort -ShowPagination -Id 'Table1'$Columns = @(
New-UDTableColumn -Property Dessert -Title "A Dessert"
New-UDTableColumn -Property Calories -Title Calories
New-UDTableColumn -Property Fat -Title Fat
New-UDTableColumn -Property Carbs -Title Carbs
New-UDTableColumn -Property Protein -Title Protein
)
New-UDTable -ShowRefresh -Columns $Columns -LoadData {
$Query = $Body | ConvertFrom-Json
<# Query will contain
filters: []
orderBy: undefined
orderDirection: ""
page: 0
pageSize: 5
properties: (5) ["dessert", "calories", "fat", "carbs", "protein"]
search: ""
totalCount: 0
#>
@(
@{Dessert = 'Frozen yoghurt'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
) | Out-UDTableData -Page 0 -TotalCount 5 -Properties $Query.Properties
}$Theme = @{
overrides = @{
MuiTableRow = @{
root = @{
'&:nth-of-type(odd)' = @{
backgroundColor = "rgba(0,0,0,0.04)"
}
}
head = @{
backgroundColor = "rgb(255,255,255) !important"
}
}
}
}
New-UDDashboard -Content {
$data = 1..10 | % { [PSCustomObject]@{ Item = $_}}
New-UDTable -ShowPagination -PageSize 10 -PageSizeOptions @(10, 10) -DisablePageSizeAll -Columns @(
New-UDTableColumn -Property 'Item' -Title 'Item' -Width 180 -Truncate
) -Data $Data -Dense -ShowSearch
} -Theme $Theme





