This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-SSSecret -KeyPath C:\keyfile.bin -Name 'password' -Value 'P@$$w0rd' -StorePath C:\store.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Export-SSKey -KeyPath C:\keyfile.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When I have real-time protection enabled, it takes about 100x as long to run this script. | |
# Defender is using like 60% of CPU on 8 core box | |
pwsh -Command "(Get-Date).ToFileTimeUtc()" > "$(ProjectDir)\BuildDate.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DBG]: PS C:\Users\adamr>> $Job = Get-UAJob -Id 1 | |
[DBG]: PS C:\Users\adamr>> Get-UAJobPipelineOutput -Job $Job | |
Name Value | |
---- ----- | |
ResponseSize 151366 | |
ResponseTime 1690 | |
StatusCode 200 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Script = Get-UAScript -Name 'Check website.ps1' | |
$Schedule = New-UASchedule -Script $Script -Continuous -DelayMinute 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Script = Get-UAScript -Name 'Check website.ps1' | |
$Schedule = New-UASchedule -Script $Script -Cron '*/2 * * * *' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Script = New-UAScript -Name 'Check Website' -ScriptBlock { | |
$Stopwatch = [System.Diagnostics.Stopwatch]::new() | |
$Stopwatch.Start() | |
try | |
{ | |
$Response = Invoke-WebRequest https://ironmansoftware.com | |
$ResponseTime = $Stopwatch.ElapsedMilliseconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-UDRestApi | Stop-UDRestApi | |
$Endpoint = New-UDEndpoint -AcceptFileUpload -Url "/process" -Method "POST" -Endpoint { | |
param($File) | |
Write-UDLog "GOT A FILE!" | |
$filepath = "C:\temp\dev\testdash\" | |
$filename = New-Item -Path $filepath -Name "$(get-random).txt" | |
if (!($File)) { | |
throw "file is empty." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module "$PSScriptRoot/UniversalDashboard.psd1" | |
Import-Module "$PSScriptRoot/UniversalDashboard.CodeEditor/1.0.1/UniversalDashboard.CodeEditor.psd1" | |
Import-Module "$PSScriptRoot/UniversalDashboard.Helmet/1.0.1/UniversalDashboard.Helmet.psd1" | |
Import-Module "$PSScriptRoot/UniversalDashboard.Style/1.0.0/UniversalDashboard.Style.psd1" | |
Import-Module "$PSScriptRoot/UniversalDashboard.Diagrams/1.0.1/UniversalDashboard.Diagrams.psd1" | |
Import-Module "$PSScriptRoot/UniversalDashboard.SyntaxHighlighter/1.0.0/UniversalDashboard.SyntaxHighlighter.psd1" | |
Import-Module "$PSScriptRoot/UniversalDashboard.ObjectTree/1.0.1/UniversalDashboard.ObjectTree.psd1" | |
# Provides the New-CustomDashboard cmdlet. | |
Import-Module "$PSScriptRoot/Dashboard/Dashboard.psd1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$auth = @() | |
$auth += New-UDAuthenticationMethod -Endpoint { | |
param([PSCredential]$Credential) | |
$userName = $Credential.UserName | |
$role = if ($userName -eq 'Adam') { | |
'admin' | |
} else { | |
'luser' | |
} | |
$Token = Grant-UDJsonWebToken -Identity $UserName -Role $Role -Issuer 'Adam' |