Created
January 29, 2020 16:36
-
-
Save adamdriscoll/210d34ffaae0cc74d38d079d9df7a8ec to your computer and use it in GitHub Desktop.
Full example for this post
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 UniversalAutomation | |
Import-Module UniversalAuotmation.Dashboard | |
Import-Module PSSecretStore | |
$ComputerName = "http://localhost:10000" | |
Start-UAServer -Port 10000 | |
$Cache:ComputerName = $ComputerName | |
Connect-UAServer -ComputerName $ComputerName | |
$Dashboard = New-UADashboard | |
$Script = New-UAScript -Name 'Whoami' -ScriptBlock { | |
whoami | |
} | |
Export-SSKey -KeyPath F:\keyfile.bin | |
Set-SSSecret -Name 'password' -Value 'P@$$w0rd' -KeyPath F:\keyfile.bin -StorePath F:\store.bin | |
$SecretManager = New-UASecretManager -Name 'PSSecretStore' -Get { | |
param($Name) | |
Get-SSSecret -Name $Name -KeyPath F:\keyfile.bin -StorePath F:\store.bin | |
} -Set { | |
param($Name, $Value) | |
Set-SSSecret -Name $Name -Value $Value -KeyPath F:\keyfile.bin -StorePath F:\store.bin | |
} | |
New-UAVariable -Name 'password' -Value 'P@$$w0rd' -SecretManager $SecretManager | Out-Null | |
$PasswordVariable = Get-UAVariable -Name 'password' | |
$Credential = New-UACredential -UserName 'iis' -Password $PasswordVariable | |
Invoke-UAScript -Script $Script -Credential $Credential | |
New-UASchedule -Script $Script -Cron '*/2 * * * *' -Credential $Credential | Out-Null | |
Start-UDDashboard -Dashboard $Dashboard -Port 10001 -AdminMode | |
Start-Process http://localhost:10001 | |
Wait-Debugger | |
Stop-UAServer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment