Install UniversalDashboard.Community 2.7.0
Install Module
PS C:\> Install-Module UniversalDashboard.Community -AcceptLicense
Copy below content in notepad and save it to ps1
PS C:\PS\Dashboard> .\download_files_with_search.ps1
Copy below content in notepad and save it to ps1
$Host.UI.RawUI.WindowTitle = "Developed by Ravindra Sharma"
$Root = $PSScriptRoot
$EndpointInit = New-UDEndpointInitialization -Variable Root
$Folder = Publish-UDFolder -Path (Join-Path $PSScriptRoot "files") -RequestPath "/files"
$Dashboard = New-UDDashboard -Title "Download" -Content {
New-UDGrid -Title "Software Portal" -Headers @("Name","Size","Download") -Properties @("Name","Size","Download") -Endpoint {
Get-ChildItem -Path (Join-Path $Root "files") | ForEach-Object {
[PSCustomObject]@{
Name = $_.Name
Size = "$([Math]::Floor($_.Length / 1KB))KB"
Download = New-UDLink -Text "Download" -Url "/files/$($_.Name)"
}
} | Out-UDGridData
} -FontColor "black"
} -EndpointInitialization $EndpointInit
Start-UDDashboard -Dashboard $Dashboard -AutoReload -Port 1000 -PublishedFolder $Folder
PS C:\PS\Dashboard> .\download_files_with_search.ps1