@@ -77,8 +77,9 @@ process {
7777 Start-Transcript - Path " $env: SystemDrive \choco-setup\logs\Set-SslCertificate-$ ( Get-Date - Format ' yyyyMMdd-HHmmss' ) .txt"
7878
7979 # Dot-source helper functions
80- . .\scripts\Get-Helpers.ps1
81- # Collect current certificate configuration
80+ $ScriptDir = Join-Path $PSScriptRoot " scripts"
81+ . $ScriptDir \Get-Helpers.ps1
82+ # Collect current certificate configuration
8283 $Certificate = if ($Subject ) {
8384 Get-Certificate - Subject $Subject
8485 }
@@ -138,14 +139,6 @@ process {
138139 # Connect to Nexus
139140 Connect-NexusServer - Hostname $SubjectWithoutCn - Credential $Credential - UseSSL
140141
141- # Add updated scripts to raw repo in Nexus
142-
143- # Push ChocolateyInstall.ps1 to raw repo
144- $ScriptDir = " $env: SystemDrive \choco-setup\files\scripts"
145- $ChocoInstallScript = " $ScriptDir \ChocolateyInstall.ps1"
146- (Get-Content - Path $ChocoInstallScript ) -replace " {{hostname}}" , $SubjectWithoutCn | Set-Content - Path $ChocoInstallScript
147- New-NexusRawComponent - RepositoryName ' choco-install' - File " $ChocoInstallScript "
148-
149142 # Push ClientSetup.ps1 to raw repo
150143 $ClientScript = " $ScriptDir \ClientSetup.ps1"
151144 (Get-Content - Path $ClientScript ) -replace " {{hostname}}" , $SubjectWithoutCn | Set-Content - Path $ClientScript
@@ -288,7 +281,7 @@ process {
288281
289282 $ScriptBlock | Set-Content - Path $EndpointScript
290283
291- # Agent Setup
284+ # Agent Setup
292285 $agentArgs = @ {
293286 CentralManagementServiceUrl = " https://$ ( $SubjectWithoutCn ) :24020/ChocolateyManagementService"
294287 ServiceSalt = $ServiceSaltValue
@@ -300,14 +293,14 @@ process {
300293
301294 else {
302295
303- # Agent Setup
296+ # Agent Setup
304297 $agentArgs = @ {
305298 CentralManagementServiceUrl = " https://$ ( $SubjectWithoutCn ) :24020/ChocolateyManagementService"
306299 }
307300
308301 Install-ChocolateyAgent @agentArgs
309302
310- # Register endpoint script
303+ # Register endpoint script
311304 (Get-Content - Path $EndpointScript ) -replace " {{hostname}}" , " '$SubjectWithoutCn '" | Set-Content - Path $EndpointScript
312305 if ($IsSelfSigned ) {
313306 $ScriptBlock = @"
0 commit comments