From ec6a9a96ec5cac8452ae9c3abbc9440d1cee67b1 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Mon, 29 Jan 2024 11:58:20 -0500 Subject: [PATCH] use master password to change agent settings --- Install-EmberkomCloudBackup.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Install-EmberkomCloudBackup.ps1 b/Install-EmberkomCloudBackup.ps1 index a093e5b..9b36564 100644 --- a/Install-EmberkomCloudBackup.ps1 +++ b/Install-EmberkomCloudBackup.ps1 @@ -39,7 +39,12 @@ Start-Sleep -Seconds 10 # Set the agent edition # Note: the product edition must be set *after* the user is added Write-Output "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition""" -Try { Set-MBSAgentSetting -Edition $AgentEdition -Verbose } +Try { + Switch ([string]::IsNullOrEmpty($MasterPassword)) { + $true { Set-MBSAgentSetting -Edition $AgentEdition -Verbose } + $false { Set-MBSAgentSetting -Edition $AgentEdition -MasterPassword (ConvertTo-SecureString -String $MasterPassword -AsPlainText -Force) -Verbose } + } +} Catch { Write-Error $_.Exception.Message } # Delete the desktop icon