Set-Secret | Get-Secret
DeployR 1.2 introduced the ability to create secrets on the server and use them in task sequences. Several built-in DeployR steps use this method and can serve as examples.
Enable Administrator account [EnableAdmin.ps1]
Enable BitLocker [EnableBitLocker.ps1]
Get-Secret and Set-Secret are part of the Microsoft.PowerShell.SecretManagement module, which ships with DeployR so that clients without internet access do not need to download it.
The module provides authenticated access to secret values using the standard DeployR authentication mechanisms. Values are stored in the server database and retrieved by the client when needed. They can then be used and discarded without being written to disk, making them unavailable for retrieval after OSD and more secure than embedding credentials in a script or task sequence variable.
Create Secret
Connect to the DeployR server using the PowerShell module, then run Set-Secret:
Set-Secret -Name "DellBIOSPassword" -Secret "P@ssw0rd" -Vault DeployRThis example creates a secret named DellBIOSPassword with the value P@ssw0rd.
Retrieve Secret
To test from Windows, connect to the DeployR server using PowerShell and run Get-Secret:
Get-Secret -Name "DellBIOSPassword" | ConvertFrom-SecureString -AsPlainTextWhen running in a task sequence, adding something similar to this in your PowerShell script will pull the secret into a variable.
try {
$SecretBIOSPassword = Get-Secret -Vault DeployR -Name "DellBIOSPassword" | ConvertFrom-SecureString -AsPlainText -ErrorAction Stop
}
catch {
Write-Warning "DellBIOSPassword secret not found. Checking task sequence environment variable fallback."
}Console Example:

Last updated

