Hey so if I store a secret variable how do I retrieve it from a dashboard?
Thanks
Hey so if I store a secret variable how do I retrieve it from a dashboard?
Thanks
1.4 will add this functionality.
For the time being, you will have to use Get-Secret from the MSFT secret management module.
Can you give more of an example? Will Get-Secret just work or do I have to load a module?
The module is included in Universal so depending on how you have it installed, you can import it from the installation directory.
For example, if you installed via MSI.
Import-Module "${env:ProgramFiles(x86)}\Universal\Microsoft.PowerShell.SecretManagement\0.2.1\Microsoft.PowerShell.SecretManagement.psd1"
Then you can just get your secrets out.
$SuperSecretPassword = Get-Secret -Name 'MySecret' -AsPlainText
Great,
Thanks Very much
Adam if I want to import the UD module into powershell what file is it?
I want to look at the components attributes.
I tried:
Import-Module “C:\Program Files x86)\Universal\UniversalDashboard\Frameworks\v3\UniversalDashboard.psd1”
and
Import-Module “C:\Program Files (x86)\Universal\Universal.psd1”
Both of these dont work.
Frameworks are stored here:
C:\ProgramData\PowerShellUniversal\Dashboard\Frameworks\UniversalDashboard
You’ll need to import the Universal module first.
If you install the VS Code extension for Universal, it has an import modules button.
https://marketplace.visualstudio.com/items?itemName=ironmansoftware.powershell-universal
I dont use VS and dont really want too.
As for the above
Import-Module “C:\Program Files (x86)\Universal\Universal.psd1”
Import-Module : Could not load file or assembly ‘Newtonsoft.Json, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleComma
Are you running that in PowerShell.exe?
Yes I am
Can you try loading NewtonSoft directly? Another module may be conflicting with the newtonsoft version.
[System.Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\Universal\NewtonSoft.Json.dll")
Import-Module “C:\Program Files (x86)\Universal\Universal.psd1”
The first line ran
But the second still errors
Import-Module “C:\Program Files (x86)\Universal\Universal.psd1”
Import-Module : Could not load file or assembly ‘Newtonsoft.Json, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
I just realized we have 2 different versions of newtonsoft (arrrrgghhhh newtonsoft versions…).
What if you load from the cmdlets directory?
[System.Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\Universal\Cmdlets\NewtonSoft.Json.dll")
Import-Module “C:\Program Files (x86)\Universal\Cmdlets\Universal.psd1”
Looks good let me try and load the dashboard module now
Its alive