mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-15 12:34:25 +01:00
66 lines
1.7 KiB
Markdown
66 lines
1.7 KiB
Markdown
|
## The *open-dashboards.ps1* Script
|
||
|
|
||
|
This PowerShell script launches the Web browser with some dashboard websites.
|
||
|
|
||
|
## Parameters
|
||
|
```powershell
|
||
|
/home/mf/Repos/PowerShell/Scripts/open-dashboards.ps1 [<CommonParameters>]
|
||
|
|
||
|
[<CommonParameters>]
|
||
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||
|
```
|
||
|
|
||
|
## Example
|
||
|
```powershell
|
||
|
PS> ./open-dashboards
|
||
|
|
||
|
```
|
||
|
|
||
|
## Notes
|
||
|
Author: Markus Fleschutz | License: CC0
|
||
|
|
||
|
## Related Links
|
||
|
https://github.com/fleschutz/PowerShell
|
||
|
|
||
|
## Source Code
|
||
|
```powershell
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Open dashboards
|
||
|
.DESCRIPTION
|
||
|
This PowerShell script launches the Web browser with some dashboard websites.
|
||
|
.EXAMPLE
|
||
|
PS> ./open-dashboards
|
||
|
.LINK
|
||
|
https://github.com/fleschutz/PowerShell
|
||
|
.NOTES
|
||
|
Author: Markus Fleschutz | License: CC0
|
||
|
#>
|
||
|
|
||
|
try {
|
||
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||
|
Write-Host "⏳ (1/2) Loading Data/popular-dashboards.csv..."
|
||
|
$Table = Import-CSV "$PSScriptRoot/../Data/popular-dashboards.csv"
|
||
|
$NumRows = $Table.Length
|
||
|
Write-Host "⏳ (2/2) Launching Web browser with dashboards... " -noNewLine
|
||
|
foreach($Row in $Table) {
|
||
|
$Name = $Row.NAME
|
||
|
$URL = $Row.URL
|
||
|
Write-Host "$Name · " -noNewline
|
||
|
& "$PSScriptRoot/open-default-browser.ps1" "$URL"
|
||
|
Start-Sleep -milliseconds 50
|
||
|
}
|
||
|
Write-Host ""
|
||
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||
|
"Hint: use switch-tabs.ps1 to switch the browser tabs automatically"
|
||
|
"✅ Opened $NumRows dashboards in $elapsed sec"
|
||
|
exit 0 # success
|
||
|
} catch {
|
||
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||
|
exit 1
|
||
|
}
|
||
|
```
|
||
|
|
||
|
*Generated by convert-ps2md.ps1 using the comment-based help of open-dashboards.ps1*
|