@@ -195,6 +195,17 @@ process {
195195 }
196196 choco config set centralManagementServiceUrl " $ ( $CcmEndpoint ) :24020/ChocolateyManagementService"
197197
198+ # Generate CCM Salt Values
199+ if (-not (Get-ChocoEnvironmentProperty ClientSalt)) {
200+ $ClientSaltValue = New-ServicePassword
201+ Set-ChocoEnvironmentProperty ClientSalt $ClientSaltValue
202+ }
203+
204+ if (-not (Get-ChocoEnvironmentProperty ServiceSalt)) {
205+ $ServiceSaltValue = New-ServicePassword
206+ Set-ChocoEnvironmentProperty ServiceSalt $ServiceSaltValue
207+ }
208+
198209 # Updating the Registration Script
199210 $EndpointScript = " $PSScriptRoot \scripts\Register-C4bEndpoint.ps1"
200211 Invoke-TextReplacementInFile - Path $EndpointScript - Replacement @ {
@@ -234,20 +245,9 @@ process {
234245 Set-ChocoEnvironmentProperty CCMEncryptionPassword $CCMEncryptionPassword
235246 }
236247
237- # Set Client and Service salts
238- if (-not (Get-ChocoEnvironmentProperty ClientSalt)) {
239- $ClientSaltValue = New-ServicePassword
240- Set-ChocoEnvironmentProperty ClientSalt $ClientSaltValue
241-
242- Invoke-Choco config set centralManagementClientCommunicationSaltAdditivePassword $ClientSaltValue.ToPlainText ()
243- }
244-
245- if (-not (Get-ChocoEnvironmentProperty ServiceSalt)) {
246- $ServiceSaltValue = New-ServicePassword
247- Set-ChocoEnvironmentProperty ServiceSalt $ServiceSaltValue
248-
249- Invoke-Choco config set centralManagementServiceCommunicationSaltAdditivePassword $ServiceSaltValue.ToPlainText ()
250- }
248+ # Set Client and Service salts in Chocolatey Config
249+ Invoke-Choco config set centralManagementClientCommunicationSaltAdditivePassword $ClientSaltValue.ToPlainText ()
250+ Invoke-Choco config set centralManagementServiceCommunicationSaltAdditivePassword $ServiceSaltValue.ToPlainText ()
251251
252252 # Set Website Root Address
253253 Update-CcmSettings - CcmEndpoint $CCmEndpoint - Credential $CCMCredential - Settings @ {
0 commit comments